How do I show a Mendix exception in the client from a Java action.

I am calling a java action in a microflow. When the action throws a exception I want to catch it and use this exception further in the flow. How can I do this?
3 answers

I think it's best to create a meta object to store the information about the exception in. Let the java action return an object of this type and store the error message in it. You can also add an attribute of type boolean to the meta object to store if the java action completed successfully. Now you can use it anywhere in your microflow.

  1. You can return false in your Java action when an error occurs and true when no error occurs.
  2. You can use this variable in your microflow and for instance with a show message activity show an error.

Or if you want to make a difference between errors you can return a string with the error type and use this in your microflow.


Sure. There are absolutely no model changes needed for this functionality. Use the following code within the execute function of your JAVA action:

this.addTextMessageFeedback(MessageType.ERROR, exception.getStackTrace().toString(), true);


  • the first parameter is the type of the message (warning / info / error)
  • the second parameter is the catched exception
  • the last parameter determines if the message is shown as a blocking message or not