Action Messages & coroutines & Exceptions Handling.

Aug 10, 2010 at 9:55 AM

I am getting strange behavior if I throw exceptions inside my actions on purpose. (I am testing error handling of my appy)

How are we to handle exceptions that originate within an action "handler"?

It seems like the 1st exception I throw somehow ends up at Application.UnhandledException, but not the 2nd & 3rd... etc.

When I investigated what CM does, it catches exceptions and makes them disappear. How the 1st exception got through I have no clue.

Any idea how we are supposed to get to those exceptions?

 

Coordinator
Aug 10, 2010 at 2:07 PM
Would you be willing to email me a solution that demonstrates the issues? Thanks. robertheisenberg at hotmail dot com
Aug 10, 2010 at 5:46 PM

Here is where my search ended inside SequentialResult.cs:

         void ChildCompleted(object sender, ResultCompletionEventArgs args)
        {
            if(args.Error != null || args.WasCancelled)
            {
                OnComplete(args.Error, args.WasCancelled);
                return;
            }

            var previous = sender as IResult;

            if(previous != null)
                previous.Completed -= ChildCompleted;

            if(enumerator.MoveNext())
            {
                try
                {
                    var next = enumerator.Current;
                    IoC.BuildUp(next);
                    next.Completed += ChildCompleted;
                    next.Execute(context);
                }
                catch(Exception ex)
                {
                    OnComplete(ex, false);
                    return;
                }
            }
            else OnComplete(null, false);
        }
That try catch block at the end is what I am talking about. I don't know how to get to those exceptions from outside CM.
Coordinator
Aug 10, 2010 at 6:09 PM
I added a ticket to improve this.
Aug 10, 2010 at 6:10 PM

Thanks.