linode_api4-python
linode_api4-python copied to clipboard
Add field hint to error messages
Relates to #208
In the above issue, it wasn't obvious what the API was complaining about. This is because the API sends more than just a message for most errors; it also sends back the "field" the error applied to. We were hiding that for users (unintentionally) in this library.
This change adds the field to errors reported via this library, which should help improve debugging of errors returned by the API.
A new error looks like this:
ApiError: 400: [group] Length must be 1-50 characters;
For errors with no field, they return as they did before:
ApiError: 405: Method Not Allowed;