Error handling/messages


If an error occurs a JSON object describing the error will be included in the response.

The object will always include a main message giving a general description of the error.

If the error is due to invalid data, an array invalid fields may be included, if it is present the array will also contain detailed and end-user messages.

In addition to this, you may get an array with more details if the error is caused by invalid data in the request.

1
2
3
4
5
6
7
8
9
{
    "message": "Validation failed",
    "errors": [
        {
            "name": "dueDate",
            "message": "dueDate is before invoiceDate"
        }
    ]
}

The client may also include a header - End-User-Message: true - requesting simplified error messages suitable for end-users.

These simplified error messages are currently only available in Norwegian.