TwythonError hides too many details from error message
errors are raised something like:
raise TwythonError(
error_message, # text of first error if there are multiple
error_code=response.status_code,
)
In Twitter API docs the errors are assigned an error code
For example the rate limit for posting status updates will return http 403 with error code 88, but the TwythonError only gives us 403 (plus the message "Rate limit exceeded")
So we can match on the text of the error but we wonder if Twitter may localise the text or amend the description at some point.
It would be nice to have access to the error code in error_code, with the http response status code as a separate attribute. In fact it would be useful to have the whole error body to work with.
@anentropic that sounds wonderful. I'd be open to a PR that changes error_code to the Twitter error_code and a new status_code attribute on TwythonError