CakeTaskBuilderOfTExtensions.

OnError<TData>(CakeTaskBuilder<TData>, Func<Exception, ICakeContext, TData, Task>) Method

Summary

Adds an error handler to be executed if an exception occurs in the task.
Namespace
Cake.Core
Containing Type
CakeTaskBuilderOfTExtensions

Syntax

public static CakeTaskBuilder<TData> OnError<TData>(this CakeTaskBuilder<TData> builder, Func<Exception, ICakeContext, TData, Task> errorHandler) 
    where TData : class

Type Parameters

Name Description
TData The extra data to operate with inside the error handler.

Parameters

Name Type Description
builder CakeTaskBuilder<TData> The builder.
errorHandler Func<Exception, ICakeContext, TData, Task> The error handler.

Return Value

Type Description
CakeTaskBuilder<TData> The same CakeTaskBuilder<TData> instance so that multiple calls can be chained.