There seems to be random issues with connecting to the API that causes a 500 error. There should be a try/catch statement surrounding the API call to handle whenever Guzzle fails to connect.
GuzzleHttp\Exception\ConnectException: cURL error 28: Resolving timed out after 2512 milliseconds (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) in GuzzleHttp\Handler\CurlFactory::createRejection() (line 185 of /var/www/html/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php).
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 3070016.patch | 1.27 KB | chadmandoo |
Comments
Comment #2
chadmandoo commentedTemporary fix that will catch a GuzzleHttp\Exception\ConnectException and display a drupal_set_message. Ideally in the long run there should be an option on how to handle connection errors. Should the user be able to bypass this if the API is down or should it force them to only change it when the API is up?
Comment #3
esolitosHello and thanks for your contribution!
The error above seems to be related to your dns resolver, nonetheless this should be indeed handled gracefully.
Usually HIBP, which is run over Cloudflare, is really fast in the answers so I didn't put to much thinking on that point, however connection errors can still occur due to other factors.
Comment #5
esolitosYou can check the commit above, it improves the handling of any Guzzle error (basically all network errors).
Comment #6
chadmandoo commentedThanks for the quick fix!