How to throw exception in nanoflow

0
I have a complex nanoflow that can generate several runtime error. I would like to throw an exception in order to be able to cleanly handle it in the calling nanoflow (To redirect on an error page or to display a relevant message). However, the "Error event" can only be used in Microflow : https://docs.mendix.com/refguide/error-event/ Same problem with the "Throw exception" activity from Community Common which is a Java action.   There are some activities in Nanoflow that have error handling, so surely this is doable, but I haven't been able to find a way create it on a user level.   I think about using a "Call Javascript" action, throwing a new exception, but that doesn't feel really clean.   Am I missing out on something ?    
asked
2 answers
1

Hi Kevin

 

May I ask why you are not using the default error handling within the actions. Within a nanoflow there is the option on most activities to implement error handling behaviour. That way you can dynamically redirect your logic if an error occurs. 

The only limitation a nanoflow offers here is that the nanoflow only has 'Abort' and 'Custom without rollback' as error handling options (compared to the more comprehensible list within Microflows). The latter option within the nanoflow possibilities could solve your problem.

I also added a link to the documentation so you can read up on it more: https://docs.mendix.com/refguide/error-handling-in-nanoflows/

I hope this can give you some direction. Good luck!

answered
0

You can call a microflow inside your nanoflow, maybe with that you will be able to do what you want.

answered