0
votes

I would like to know if IBM Worklight has out of the box support for not propagating the error details to the client in the response. To illustrate, let's suppose that while processing a request, per some reason something went wrong and the server responds it with a body similar to:

{"errors":["Some exception/error details go here..."],"isSuccessful":false,"warnings":[],"info":[]}

However, I don't want the consumer to be aware of the such details, neither to inflate my response with it. Does IBM Worklight provide any way to change such behaviour and, for example, send the errors array empty or at least to transform it before sending the response to the client?

1

1 Answers

2
votes

Worklight server responds to requests from the client. Depending on the case, this may be a valid response to the request or an error message, in case something did not go as per plan. Note that in this case, the response flow enters the failure callback of the listener.

The error message is passed back in a format understood by the developer such that they can account for these and take corrective actions. This message is not intended for the end user, but for the developer to handle. In case the message is too descriptive ( or too technical), it is left to the developer to show a generic or proper message.

For example, instead of "An exception was thrown because the input parameter is wrong" can be presented to the end user as "Please verify your input..." .

In case the error is resulting from the adapter - when adapter receives an error from the backend, it can be checked and modified at the adapter, before passing back to the client. Similarly, if errors from exceptions at the adapter can be caught and handled, custom responses can be sent back to the client.

If the error results from exceptions or other conditions, Worklight server cannot be configured to the send errors array empty or transform the response before sending the response to the client. This is for the developer to handle at client side.