REST API errors should send a meaningful response when things don't go as planned.
In LANSA's REST API definition, all operations are generated in the OpenAPI spec as having a default response schema of type xUnexpectedError.
This schema type is predefined by LANSA. It returns an error with message strings defined like this:
We use this schema in our examples in a routine MakeBadRequestResponse. The structure allows for multiple error messages to be sent. In our examples we only use one optional additional message to give more information about an error.
For example, in GetContacts when there are no contacts to return, we can use it like this: