integreat-cms
integreat-cms copied to clipboard
Add Textlab error logging
Motivation
Currently, when the Textlab API returns an error response, it's logged like this:
Apr 09 18:45:50 WARNING integreat_cms.cms.views.utils.hix - HIX benchmark API call failed: 'HTTP Error 400: Bad Request'
But sometimes it's not quite clear exactly what the problem was. The Textlab API provides some description of the error in the message field in the response body. For example:
{
"message": "Invalid username/password"
}
I think it would be nice to log it as well.
Proposed Solution
If Textlab returns an error response, log the error message
Alternatives
Leave as is
Additional Context
Hint for reproduction: change Textlab API username to the wrong one or try to calculate HIX on the page with an image only.