Chapter 3
Errors
This chapter describes how errors are structured.
Structure
Every response has the following structure.
{
success: true,
msg: "Success response",
data: {}
}
{
success: false,
msg: "Error response",
data: {},
error_code: "000001"
}
The most important field is error_code. This error code specifies which is the specific error that application throws. The first three digits specifies the error scope.
000: No scope. This error is thrown when there is no specific scope associated to this error. For example an infrastructure error or a bad request error.001: Users scope. This scope specifies that the throwed error happens when trying to do an action with users. Adding a user, getting users, updating users, etc.002: Auth scope. This scope specifies that the throwed error happens when trying to do an authentication action. Login, signup, logout, refresh token, etc.003: Room scope. Means that an error is throwed whil doing a room action. Joining to a room, adding a room, etc.
The las three digits are used to identify the specific error inside the scope
For example: 000000 This error is thrown when trying to acces to a resource or feature that is not implemented yet.