#11 add errorhandlers to handle network problem
Merged by mjia. Opened by mjia.
mjia/greenwave master  into  master

Download 11.patch

If there is a network prolbem on ResultsDB side, this will be handled and return a message like this instead of a traceback to the caller.

HTTPSConnectionPool(host='taskotron.dev.fedoraproject.org', port=443): Max retries exceeded with url: /resultsdb_api/api/v2.0/results?item=java-1.8.0-openjdk-1.8.0.131-3.b12.el7_3&testcases=dist.rpmdiff.comparison.xml_validity,dist.rpmdiff.comparison.virus_scan,dist.rpmdiff.comparison.upstream_source,dist.rpmdiff.comparison.symlinks,dist.rpmdiff.comparison.binary_stripping (Caused by NewConnectionError(': Failed to establish a new connection: [Errno -5] No address associated with hostname',))

This should return HTTP 503. It would also be appropriate to add an error handler for Timeout (which doesn't inherit from ConnectionError) and also return HTTP 503.

Personally, I'd pass the app object to a register_error_handlers function and have all the registration happen there.

Good points.

rebased

Rebased to address the comments.

s/regist/register

Seems fine to me

rebased

We could probably make the error handler a bit more sophisticated (or at least return a slightly nicer response) but this is fine.

:+1:

Pull-Request has been merged by mjia

Metadata