This will show you what each error code means and how we setup the syntax for responses.
x
normally means that it might have extra text on it.
'1000' (unknown_error): 'App Server Error, please contact the admin' # Global Error
'1001' (headers_missing): 'Missing Headers'
'1002' (params_missing): 'Missing Parameters'
'1003' (): 'Invalid offset or limit'
'1004' (): 'Invalid Locale'
'1005' (rate_limit_hit): 'You exceeded the limit of requests per minute, Please try again after sometime.'
'1006' (unstable_call): 'The API Path is unstable (beta/testing)' # The API path being called is currently in beta/testing and is unreliable, watch what you do!
'1101' (no_auth): 'Unauthorized'
'1102' (auth_not_allowed): 'Not authorized to access'
'1103' (): 'Unprocessable Entity'
'1104' (auth_failed): 'Authentication Failed'
'1105' (not_found): 'Not Found' # Normally 404 errors for unknown paths
'1106' (not_valid_client): 'Invalid Client' # Requires you to be the website etc. If client keeps doing this we will ban the ip/client.
Most of these errors will redirect to login w/ Discord
'1201' (session_expired): 'Your session is expired, please login again' # Token expired
'1202' (discord_session_invalid): 'Your session is invalid' # Discord token verification error
'1203' (session_invalid_decode): 'Your session is invalid' # Error encountered while decoding
'1204' (session_invalid_token): 'Your sessions token is invalid' # Invalid token
'1205' (session_unauth): 'You are Unauthorized, Please login' # You are Unauthorized, Please login.
'1206' (session_auth_issue): 'Authentication Error, User Not found' # Authentication Error, User Not found
'1301' (): 'Invalid Credentials'
'1302' (user_banned): 'User Banned' # The staff at Grace have banned your discord account from Grace.
no_data_found: 'No data found'
not_found: 'Not found'
x_not_found: '%{name} not found!'
update_successfully: 'Updated successfully'
x_update_successfully: '%{name} updated successfully'
created_successfully: 'Created successfully'
x_created_successfully: '%{name} created successfully'
deleted_successfully: 'Deleted successfully'
x_deleted_successfully: '%{name} deleted successfully'
request_submitted: 'Order %{code} Code has been Submitted successfully'
orders_not_found: 'No orders yet'
The main response structure have 4 keys which are
1) error_code code to indicate if there was an error
2) Success always returning true or false if the response is success will returning true otherwise will get false
3) Message it’s better to return the response message from back-end
4) error_find to let the client/user understand the error code if they dont have a doc with error_code meanings.
4) data which is the main key and will have the data that should be displayed. Errors may use this to output some info if needed.
How we format syntaxes that are sent back to the client.
The action was successful.
{
"success": true,
"message": "User logged in successfully",
"data": {/*...*/}
}
The action was not successful and an error code was given.
{
"success": false,
"message": "Missing Parameters",
"error_code": 1002,
"error_find": null,
"data": {}
}
Normally means a big issue happened and contact staff.
{
"success": false,
"message": "...",
"error_code": null,
"error_find": null,
"data": {}
}