Problem/Motivation
When the endpoint is down, and you go to a direct link of a search result page (because someone gave it to you for example), you get a white page "unexpected error". The log shows why:
TypeError: Drupal\openwoo_search\Plugin\OpenWooSearch\OpenWooApp::getPublicationValues(): Argument #1 ($publication) must be of type object, null given, called in /var/www/testing.dvgemdemo.hosted-temp.com/releases/20240502142349-test-2358330/htdocs/modules/contrib/openwoo/modules/openwoo_search/src/Plugin/OpenWooSearch/OpenWooApp.php on line 174 in
Steps to reproduce
Hard to reproduce, but add a check if the $publication is an object to catch this error.
You can reproduce some of it by finding a real serach result page, and than changing the endpoint to an endpoint the publication is not available on and the api key is not accepted on.
Issue fork openwoo-3445009
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
joshahubbers commented* Added a catch to handle responses other than 200
* Added some catches to prevent php warnings for not sending a string into json_decode
Comment #4
joshahubbers commentedComment #5
perry.franken commentedComment #6
perry.franken commented