Documentation Home

Logging and Error Handling

One of the benefits of using this framework is that logging and error messages can be consolidated in the Pipeline Context state object, which contains the following two properties.

IList<string> ResultMessages

and

List<Exception> Exceptions

These cross-cutting concerns can be handled at the end of the execution of the pipeline in order to ensure a centrally located place for logging and exception handling.

the Pipeline Coordinator does its best to gracefully handle any exceptions thrown or not caught by the Operations you create. For Async Operations it is more difficult to handle those so it is always best to include try/catch blocks in the ExecuteAsync() and CompletedTaskCallback() methods of any Async Operations. If you handle exceptions yourself you can add the exception to the Exceptions property of the application’s Pipeline Context object and then handle its logging after the pipeline is finished executing. This way, you don’t have to inject and interweave logging code in all of the Operations.

However, there is nothing in the Pipelines framework that forces you to use its logging and exception handling properties. You are free to implement logging everywhere, use an Aspect-Oriented Programming approach, or not log anything at all.

If the Pipeline Coordinator catches an unhandled exception thrown in any of the Operations executed in the pipeline, then it will add it to the Pipeline Context’s Exceptions collection and set the Successful property to false for you.

The Pipeline Coordinator provides no logging capabilities whatsoever. You will have to log before the pipeline executes, after the pipeline executes, and/or within the Operations themselves if you so choose.