Replacing API default error of ENUM to custom message

0
Hello everyone,    A Rest Api service is being implemented in our flow. This is the Rest API input that a user can input:  “Person”: {       “Name”: “PersonName”;       “Relationship”: “Fathe”; } The “Relationship” attribute is an ENUM. In the example, I purposefully made a miss-type “Fathe”, so when this response is validated, it will return Mendix default error:    Error parsing JSON. com.mendix.systemwideinterfaces.core.UserException: A problem occurred parsing attribute 'Relationship' of object of type 'Person'. The value was 'Fathe'. This isn't allowed by the schema… Is there a way, where I can customize the error message instead of having the default API Mendix error handling message shown?
asked
1 answers
0

You need to set up error handling where the JSON is being parsed. In your case you probably need either Custom without Rollback or Custom with Rollback depending on your exact requirements.

https://docs.mendix.com/refguide/error-handling-in-microflows/

If the error is triggered, you can have an error handling path where you should be able to examine the error and handle it as you wish.

Good luck!

 

answered