Errors
- An error representation contains a list of errors. This is useful when more than 1 error is detected such as a list of validation errors.
- In production, debug information such as stacktrace, exception type and message aren't emitted for security and brevity.
Properties
Name |
Description |
code |
A code that is used to identify the error. |
message |
A user friendly string explaining the error. |
exceptionMessage |
A technical explanation of the error. |
exceptionType |
The type of error. |
stackTrace |
The error stack trace. |
Common Errors
Examples
Production
HTTP/1.1 404 Not Found
Content-Type: application/json; charset=utf-8
{
"errors": [
{
"code": 4002,
"message": "Unable to locate a theatre with an id of 23.",
}
]
}
Development
HTTP/1.1 400 Bad Request
Content-Type: application/json; charset=utf-8
{
"errors": [
{
"code": 4002,
"message": "Unable to communicate with a downstream system.",
"exceptionMessage": "An error has occurred.",
"exceptionType": "AMC.Ecommerce.Domain.Exceptions.ServiceException",
"stackTrace": "..."
}
]
}