The form of the responses in case of an error, differs dependent of the thrown error.
HTTP 422 Unprocessable Entity / HTTP 409 Conflict
According to the definition of HTTP response codes, the request delivers data which can not be processed or are invalid for the requested entity, or the creation / update of such an entity would lead to an conflict in the application. In both cases the result will look like the following example:
{ "errorCode": "E1094", "httpStatus": 422, "errorMessage": "User can not be saved: the chosen login does already exist.", "message": "Unprocessable Entity", "success": false, "errors": { "login": ["duplicateLogin"] }, "errorsTranslated": { "login": ["Dieser Anmeldename wird bereits verwendet."] } }
Explanation of the single fields
Field | Example Value / Type | Description |
---|---|---|
errorCode | E1094 | This is the error code linking to a brief description / explanation of the problem in the translate5 event code list. |
httpStatus | 422 or 409 | The HTTP status of the answer, as returned also in the request headers. In the explained case 422 or 409. |
errorMessage | see above | A short explanation of the error in english. |
message | Unprocessable Entity | The textual representation of the HTTP status code, here "Unprocessable Entity" or "Conflict" |
success | true or false | simple flag representing the success state of the response, here of course false. |
errors | hashmap | A hashmap containing the input field containing the value which produces the problem, and an array of string identifier of the problem in english. |
errorsTranslated | hashmap | The same structure as the above errors field, with the difference that the error texts are translated in the language of the currently authenticated user. |