jamee
jamee

Reputation: 573

In mule, how to validate the params and return with error code and message?

I developed a rest service by mule, and I want to validate the input params, throws exception when the params is invalid, and the error handler could catch the exception(a custom exception with error code and message included) and get the error code and message which i could return to client.

Currently I use the choice router to evaluate expression, and set the error expression. I think it's awkward, and inconvenient. I read the document, seems there is no such example, so what's the best way to handle the situation?

Upvotes: 0

Views: 608

Answers (1)

David Dossot
David Dossot

Reputation: 33413

If you go beyond a trivial REST resource, using choice routers won't cut it.

You have two better options:

The former is based on a standard, the latter is proprietary. In the future, the latter will receive most of MuleSoft's attention.

Upvotes: 1

Related Questions