Skip to content

Framework Exceptions

Marty Mathis edited this page Jan 22, 2019 · 14 revisions

PipelineExecutionException

PipelineExecutionException is the primary exception that can be raised during the execution of any pipeline by the framework. It serves as a wrapper exception. The framework will always throw a PipelineExecutionException for any unhandled component exception that bubbles up with one exception. Any cancellation token related exceptions, OperationCanceledException or TaskCanceledException will not be wrapped in a PipelineExecutionException. Instead they will be allowed to bubble up.

Here is an example of how you might want to handle exceptions from pipeline execution.

    try
    {
        var result = await pipeline.ExecuteAsync(payload, cancellationToken);
    }
    catch (PipelineExecutionException executionException)
    {
        logger.Error(
            executionException.InnerException, 
            "Pipeline execution halted! Component '{Name}' threw an unhandled exception.", 
            executionException.ThrowingComponent.Name);
    }

This exception also captures the throwing component as you can see in the example above.

PipelineComponentSettingNotFoundException

PipelineComponentSettingNotFoundException is thrown whenever an attempt is made to access the Settings dictionary indexer by key when the key doesn't exist. For example:

    public override void Initialize(string name, IDictionary<string, string> settings)
    {
        base.Initialize(name, settings);

        _someSetting = Settings["SomeSettingName"];
    }

This exception is very helpful tracking down missing component configurations when building large complex pipelines especially. It exposes properties for both the throwing component and the missing key.

The framework also provides helpful extension methods for configuration settings mentioned here.

PipelineComponentNotFoundException

PipelineComponentNotFoundException is thrown by the DictionaryPipelineComponentResolver whenever a call to T GetInstance<T>(string name) cannot find a component by the specified name.

Clone this wiki locally