Exception handling

Normally, when exception is thrown by activity, a processor rolls back the transaction, waits for some time and repeats the activity. If the activity has thrown too many exceptions in a row, the process is considered broken, its state is changed accordingly and it is unloaded from the processor. You can override this behavior by using exception handling.

If you wish to take some actions on exceptions of a particular type, enclose the code where you expect the exceptions with a Try-Catch-Finally block.

...
.Try()
    ...
    ...
    ...
.Catch<SomeException1>((_, ex) => { ... }) // In this lambda you can extract
    ...                                    // the data from the exception and
    ...                                    // put it to process variables.
    ...
.Catch<SomeException2>((_, ex) => { ... })
    ...  // Here you can place activities to handle the exception.
    ...  
.Finally()
    ...  // Here you can place activities to be executed
    ...  // regardless of whether an exception was thrown.
    ...
.End()
...

The Try statement opens a block that may include none, a single or many Catch statements and none or a single Finally statement. The semantics of Try-Catch-Finally repeats that in C#.

Last edited Apr 12, 2013 at 6:26 AM by dbratus, version 1

Comments

No comments yet.