-
Notifications
You must be signed in to change notification settings - Fork 194
Error Codes
We return errors in two different methods. For the main application (marks, labels, tags, etc) we return an errors
array with a list of error numbers and messages. Below are a list of errors for both the main application and supplementary actions.
Number | Message | Notes |
---|---|---|
1 | Mark could not be archived. | Mark errors have reserved error numbers from 1 to 29. |
2 | No Marks Found. | - |
3 | Mark could not be updated. | - |
4 | Mark with this id could not be found for this account. | - |
5 | Mark could not be restored. | - |
6 | Could not add mark. | - |
30 | No `label_id` was found. | Label errors have reserved error numbers from 30 to 59. |
31 | No label found using this label_id for your account. | - |
32 | No labels found for your account. | - |
33 | This type of label could not be found. | - |
34 | Label already exists for this account. | - |
35 | No options found to update for this label. | - |
36 | Label could not be created. | - |
37 | You do not have access to create a system level label. | - |
38 | Label already exists for this account. | - |
39 | Label could not be updated. | - |
60 | No tags found. | Tag errors have reserved error numbers from 60 to 89. |
61 | No tag provided. | - |
62 | Tag could not be added. | - |
600 | Security token is invalid. | System errors have reserved error numbers from 600 to 699. |
601 | Internal Error | - |
602 | Validation Errors | If you get this error the message will be an array of errors. We return multiple validation errors if found. |
It's easy to set an error. Simply reference this list, if the error doesn't fit add a new one to the App Configuration File. After that you can call the formatError helper and send the correct error number. It will return an array with the key being the error number and value being the error message.
$this->data['errors'] = formatErrors(100);
// $this->data['errors'] would be an array that looks like this
array(
100 => 'Security token is invalid.'
);
Doing this will allow you to keep your error messages in one place and fix them once.
For actions like simple ajax requests to update a password, email address or reset a password we use a simplified error report. When you get your JSON response there will always be a success
key. It will be a boolean
set to true
or false
. If false the action failed, if true you are good-to-go. If false
there will also always be a message
key returned and the value will be the error message.
On success
equals true
if data is to be returned it will be provided in the form needed. Most times when success
is equal to true
, it will be the only only key/value returned.
{
'success': false,
'message': 'The reason your request failed.'
}
{
'success': true
}
{
'success': true,
'token': 'q234asdfq345asdfaw45fdsEDET'
}