Errors and exceptions
When a system error occurs, or when an exception are thrown, there is always an error object included in the response.
The status_code is always present and represents the internal error code, handled by the system. The code shows up when the routes/controlllers throws their own exceptions.
Output from errors can look like this:
{
"message": "Unauthorized",
"code": 401,
"status_code": 500
}
In some cases there will be a block of errors:
{
"message": "The given data was invalid.",
"errors": {
"name": [
"The name field is required."
],
"email": [
"The email field is required."
],
"password": [
"The password field is required."
]
},
"status_code": 422
}
Exceptions that can be thrown during requests
| code | status_code | message | description |
|---|---|---|---|
| 401 | 500 | Insufficient role (Role list) | When a request is being made to the API and you are unauthorized. The role list in the paranthesis tells you which roles you need to reach the API route. |
| - | 422 | The given data was invalid. | During requests for creating new users this error shows what you were missing during that request. |
, multiple selections available,