You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When making a request to the Xero API, if the response is a 400 Bad Request, then an object is returned with an Elements array that contains ValidationErrors. This is inconsistent with the rest of the API, where an Errors object is returned, making it hard (unnecessary code) to gracefully handle errors.
Expected Behavior
Responses from a 400 Bad Request should return:
{
"errors": {
....
}
}
Current Behavior
Currently, the API responded with the following object after a 400 Bad Request:
{
"ErrorNumber": 10,
"Type": "ValidationException",
"Message": "A validation exception occurred",
"Elements": [{
"ValidationErrors": [{
"Message": "Email address must be valid"
}]
}]
}
Context
This change in the response of errors across the API, resulted in a runtime error where it was not immediately obvious on what the cause was. This is because we were just checking for an errors object in the response.
The text was updated successfully, but these errors were encountered:
mark-strudwick
changed the title
HTTP 400 Bad Request should follow standard error object flow
HTTP 400 Bad Request should use a standard error object
Oct 4, 2021
When making a request to the Xero API, if the response is a 400 Bad Request, then an object is returned with an
Elements
array that containsValidationErrors
. This is inconsistent with the rest of the API, where anErrors
object is returned, making it hard (unnecessary code) to gracefully handle errors.Expected Behavior
Responses from a 400 Bad Request should return:
Current Behavior
Currently, the API responded with the following object after a 400 Bad Request:
Context
This change in the response of errors across the API, resulted in a runtime error where it was not immediately obvious on what the cause was. This is because we were just checking for an
errors
object in the response.The text was updated successfully, but these errors were encountered: