Mostly important by using an api is to react on everything unusual. So in case of unexpected results or server side errors you almost have to generate a valid user output for don’t crashing your application. Normally software is alerting an ‚unexpected error‘ exception or redirects to an error page. We suggest to retry that action once and stop it on failure again with an user message like ‚error unexpectedly, please contact our support team‘.
In the 42api project we have some different results on error events.
The normal one is defined for unauthorized access. We’re firring the following JSON in that case.
{ "error": true, "codes": [ { "code": 401, "description": "Unauthorized" } ], "body": {} }
A list of all error codes look here.