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).

CommentFileSizeAuthor
#2 3070016.patch1.27 KBchadmandoo

Comments

chadmandoo created an issue. See original summary.

chadmandoo’s picture

StatusFileSize
new1.27 KB

Temporary 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?

esolitos’s picture

Assigned: Unassigned » esolitos
Priority: Critical » Normal

Hello 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.

  • esolitos committed 6f396c9 on 8.x-1.x
    Issue #3070016 by chadmandoo, esolitos: Better handling of network...
esolitos’s picture

Assigned: esolitos » Unassigned
Status: Active » Fixed

You can check the commit above, it improves the handling of any Guzzle error (basically all network errors).

chadmandoo’s picture

Thanks for the quick fix!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.