FromException()

System::Threading::Tasks::FromException(const Exception&) function

Creates a task that has completed with a specified exception.

TaskPtr System::Threading::Tasks::FromException(const Exception &exception)

Arguments

ParameterTypeDescription
exceptionconst Exception&The exception with which to complete the task.

Return Value

A faulted task.

System::Threading::Tasks::FromException(const Exception&) function

Creates a task that has completed with a specified exception and result type.

template<typename TResult> RTaskPtr<TResult> System::Threading::Tasks::FromException(const Exception &exception)

Template parameters

ParameterDescription
TResultThe type of the task’s result.

Arguments

ParameterTypeDescription
exceptionconst Exception&The exception with which to complete the task.

Return Value

A faulted task with the specified result type.

See Also