BPT Exception Handler
Application Type
Traditional Web, Reactive
Service Studio Version
11.11.13 (Build 47428)

Hi Community,

1) I have a Business Process created and at any point in time an exception occurs how to handle it? (Basically How exception is handle in Business Process) 

2) I have two Business processes P1 and P2 and P2 is been called in P1 and if any exception occurs in P2 then how exception mechanism will work in this use case?


Hi Rohan,

In BPT, you can handle the exceptions as you normally would in OutSystems. So in the automatic activity or in the action called within the automatic activity, you raise an exception if needed (e.g. when an action did not return the desired output), and then you catch the exceptions (by type as per your use cases) with an exception handler.

To mention a special case for BPTs, there is a system exception called 'Abort Activity Change Exception' and when you raise it, you prevent the activity from closing and the BPT process is not marked as "active with errors", instead it remains "active". This thread contains useful information on that.

Also worth to mention; when an unhandled exception occurs in a BPT process (including timeouts after 5 mins), it will be retried forever until it is resolved.

About your second question: Since you call a sub-process P2 from within P1, actually two different processes will be active at the same time. If an exception occurs in P2 and is not handled, status of P2 will be "Active with errors" and it will be retried automatically until the activity is closed. Thus, P1 will stay "active" (with an error at the step where P2 is called) until P2 is finished.

It really depends on your use case and how you want the system to behave, but you can actually add an output parameter to P2, catch the exception with Exception Handler and according to the type/reason of the exception, you assign a specific error message to that output parameter. Then in the flow of P1, you can use that output parameter from P2 and decide what to do further.

Hope this helps a bit.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.