linode_api4-python icon indicating copy to clipboard operation
linode_api4-python copied to clipboard

Add field hint to error messages

Open Dorthu opened this issue 3 years ago • 0 comments

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;

Dorthu avatar Oct 19 '21 15:10 Dorthu