Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Requiring a visual reference for error messages #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ Use the following HTTP status codes for errors:
* `500 Internal Server Error`: Request failed on server side, user should check status site or report the issue (preferably we track 500 errors and get notified automatically)
* `503 Service Unavailable`: API is unavailable, check status site for details

A full reference can be found here: https://http.cat/


### Provide full resources

Expand All @@ -118,7 +120,8 @@ Always provide an error code in your responses, so that applications can always
Additionally, provide 2 different error messages: one very technical for developers and one that may be directly shown to an
end user. Developers will like this approach since it requires less code handling for them.

Optionally add a link to a page for further explanation on the error.
Optionally add a link to a page for further explanation on the error. The addition of a `visualReference` for our non
English-speaking clients is mandatory.

#### Example Response
```json
Expand All @@ -129,7 +132,8 @@ HTTP Status: 500 Internal Server Error
"errorMessage" : "The connection with the DB cannot be established.",
"correlationId" : "550e8400-e29b-41d4-a716-446655440000",
"userMessage" : "Cannot handle your request at the moment. Please try again later.",
"reference" : "http://developer.leaseweb.com/errors/APP00800"
"reference" : "http://developer.leaseweb.com/errors/APP00800",
"visualReference": "https://http.cat/500"
}
```

Expand All @@ -147,6 +151,7 @@ HTTP Status: 400 Bad Request
"correlationId" : "550e8400-e29b-41d4-a716-446655440000",
"userMessage" : "Your data contains errors, please check details.",
"reference" : "http://developer.leaseweb.com/errors/APP00900",
"visualReference": "https://http.cat/400",
"errorDetails" : {
"firstName" : ["Name cannot be empty", "Name must be unique"],
"country" : ["Country cannot be empty"]
Expand Down Expand Up @@ -374,4 +379,4 @@ HTTP/1.1 200 OK
Sometimes the job might be in a state that it cannot be canceled. In this case the response is a `403 Forbidden`.

### Purged jobs
Purging can be done automatically using internal methods or not done at all. A request to an already purged job will return a `404 Not Found` response.
Purging can be done automatically using internal methods or not done at all. A request to an already purged job will return a `404 Not Found` response.