HomePhabricator

Improve API error handling

Tags
None
Referenced Files
None
Subscribers
None

Description

Improve API error handling

When mwapi detects an error response, it doesn’t return the response
with 'success' unset, it raises an APIError – so our old check for
response['success'] was useless, and API errors would instead turn into
internal server errors. Fix that by catching the APIError.

Additionally, handle one error code specially. If the API reports that
no qualifier with the given hash existed, this likely means that someone
else edited the region at the same time, so use a custom error message
for that.

Details

Provenance
LucasWerkmeisterAuthored on Jul 23 2020, 6:44 PM
Parents
R2422:f364335bf8cd: Revert "Fix JSON response loading"
Branches
Unknown
Tags
Unknown
ChangeId
None