Error and Warning codes conventions¶
This document provides a data dictionary for error and warnings codes with the convention followed to create them. It reflects our current standards and seeks to promote a common way to raise this messages across all backend services in order to provide to mobile-API and customer’s Forest App a common format.
The Error/Warning object¶
The error/warning object used to aggregate error/warning messages can be used as part of endpoint responses within an error/warning list as follows:
{
// previous response code
"errors": [
{
"code": "[TYPE]_[SERVICE]_[CODE]",
"message": "an error message as string"
}
],
"warnings": [
{
"code": "[TYPE]_[SERVICE]_[CODE]",
"message": "a warning message as string"
}
]
// next response code
}
General Structure¶
The general structure for error and warning codes is:
[TYPE]_[SERVICE]_[CODE]
Details:
TYPE: Message type:E: for error messages.W: for warning messages.
SERVICE: Service name identifiers.CODE: Specific integer code to define the error/warning.
Service names identifiers¶
Service name identifiers are a shorthand way of identifying a service, there is no convention on how to define them, but it is usually considered:
- 2-3 characters long.
- Always capital letters.
Note
add new services with its identifiers when needed
| Service Name | Identifier |
|---|---|
| forest-customers | FC |
| forest-bikes | FB |
| mobile-api | MOB |
Service codes dictionary¶
WIP