Global exception handler - doubt

hey guys…i created one simple sequence(in main.xaml) with type into activity and added global exception handler… as expected the global exception handler was working fine…
Now my doubt is i added one more xaml file(sub xaml file)…whether the activities in my sub xaml files will be handled by global exception handler? or it will handle only the activities in main.xaml file

Hi @naveenkumarr ,

If you add multiple Sub xaml files within the same exception handler, the handler will be triggered if any one of the calls the sub flows fail.

Main.xaml

Try
call Sub 1
call Sub 2
Catch Exception
   handle error if sub1 or sub 2 fails
End

For this to happen, the sub flows must not have exception handlers of their own.

Example if Sub 2 contains something like this, the error will never bubble up to the Global exception handler

Sub2.xaml

Try
  I am Sub 2 running 
Catch Exception
  Sub 2 failed. Write error to log and exit quietly
End

See what I mean? The Sub2 Catch sequence will sink the error and the global exception handler will have no idea that Sub2 xaml failed

But if you do this, the global exception handler will catch the exception thrown by Sub 2

Try
  I am Sub 2 running 
Catch Exception
  Sub 2 failed. Write error to log 
  throw sub 2error to be caught by parent global exception handler
End

Is this what you were looking for?

hi andy…thanks for the explanation…but here i’m not using any try catch activity to handle exception…all i’m using only global exception handler…will it handle the sub xmal files also ?

Sorry @naveenkumarr , I should have done this in the first place. Here is something I just put into studio with Global Exception Handler on a current test project I am working on.

image

You see my main flow has 3 sequences.

  1. The first sequence works without errors.
  2. The second sequence has all activities commented out
  3. The third sequence is a sub-flow that deliberately fails by creating a Divide by Zero exception

You can see that the Global handler catches the error created by sub-flow 3

I have set my Global handler to retry 2 times, and that is why you can see the error twice.

1 Like

thanks andy :slight_smile:

You’re welcome @naveenkumarr . I hope you have a resolution to your problem.

1 Like