The exception handler is defined as an Action Delegate. This is a method that takes no parameters and does not have a return type i.e. {code:xml}public void methodName();

Defining exception handling policies with lamda's;

var workflow = Workflow<string>.Definition();
workflow.Configure()
.On<Exception>(() => Console.WriteLine("caught"))
.When<string>().Do((x) => { throw new Exception(); });

Defining exception handling policies with methods;

// code snippet
var workflow = Workflow<string>.Definition();
workflow.Configure()
.On<Exception>(MyErrorHandler)
.When<string>().Do((x) => { throw new Exception(); });

public void MyErrorHandler()
{
// error handling code
}
{code:xml}

Last edited Mar 6, 2013 at 8:44 AM by djnz_gea, version 8

Comments

No comments yet.