-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PresidenciaPTBridge]: Support multiple sections #2082
Conversation
These sections can all be selected in parallel. There's only 4, those requests are relatively quick. This also adds a favicon.
bridges/PresidenciaPTBridge.php
Outdated
Debug::log('Key: ' . var_export($k, true)); | ||
if($this->getInput($k)) { | ||
$html = getSimpleHTMLDOMCached($this->getURI() . $k) | ||
or returnServerError('Could not load content'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recently realised that combination like getContents() or returnServerError()
does not execute second statement if error happens. Only if returned body is empty. Is that statement for empty body check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, it's to detect any error, just like in most other bridges.
Does that mean that is redundant, that errors on the request just fail the entire thing? Or do we need some extra code for that? Should that be done on the common bridge class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does that mean that is redundant, that errors on the request just fail the entire thing?
Yes. If server returns non-200 result code, exception will be raised. For me this is correct behavior, including your case.
If you need to handle errored responses, you can wrap to try catch, but in this case "Could not load content" seem to be less informative that "Error %HTTP_CODE%, Unexpected response from upstream". Like here: https://feed.eugenemolotov.ru/?action=display&bridge=Vk&u=idasfsafasf1&format=Html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this, I'll change this PR later. I'll consider this in the future.
gj! |
These sections can all be selected in parallel. There's only 4, those
requests are relatively quick.
This also adds a favicon.