Class OnErrorAttributeDecorator
Decorator for IHandlesProcessingError which handles TAL 'on-error' attributes.
This decorator is a little unusual (compared to the others) in that it really just puts a try/catch
around whatever it wraps. If there is an error and there is a TAL on-error attribute present upon the node
then this decorator will handle the error and prevent the error from halting the whole rendering process.
Inheritance
Inherited Members
Namespace: ZptSharp.Tal
Assembly: ZptSharp.dll
Syntax
public class OnErrorAttributeDecorator : IHandlesProcessingError, IProcessesExpressionContext
Constructors
| Improve this Doc View SourceOnErrorAttributeDecorator(IHandlesProcessingError, IGetsTalAttributeSpecs, IEvaluatesDomValueExpression, ILogger<OnErrorAttributeDecorator>)
Initializes a new instance of the OnErrorAttributeDecorator class.
Declaration
public OnErrorAttributeDecorator(IHandlesProcessingError wrapped, IGetsTalAttributeSpecs specProvider, IEvaluatesDomValueExpression evaluator, ILogger<OnErrorAttributeDecorator> logger)
Parameters
Type | Name | Description |
---|---|---|
IHandlesProcessingError | wrapped | Wrapped. |
IGetsTalAttributeSpecs | specProvider | Spec provider. |
IEvaluatesDomValueExpression | evaluator | Evaluator. |
Microsoft.Extensions.Logging.ILogger<OnErrorAttributeDecorator> | logger | Logger. |
Methods
| Improve this Doc View SourceHandleErrorAsync(Exception, ExpressionContext, CancellationToken)
Handles an error which was encountered whilst processing an expression context.
Declaration
public Task<ErrorHandlingResult> HandleErrorAsync(Exception ex, ExpressionContext context, CancellationToken token = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.Exception | ex | The exception indicating the error. |
ExpressionContext | context | The context to process. |
System.Threading.CancellationToken | token | An optional cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<ErrorHandlingResult> | A result object indicating the outcome of error handling. |
ProcessContextAsync(ExpressionContext, CancellationToken)
Processes the context using the rules defined within this object.
Declaration
public Task<ExpressionContextProcessingResult> ProcessContextAsync(ExpressionContext context, CancellationToken token = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
ExpressionContext | context | The context to process. |
System.Threading.CancellationToken | token | An optional cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<ExpressionContextProcessingResult> | A result object indicating the outcome of processing. |