Class TapOnFailureExtensionsAsync
- Namespace
- FunctionalDdd
- Assembly
- FunctionalDdd.RailwayOrientedProgramming.dll
Provides asynchronous extension methods for executing side effects on failed Results without changing the Result.
public static class TapOnFailureExtensionsAsync
- Inheritance
-
TapOnFailureExtensionsAsync
- Inherited Members
Remarks
These methods enable async error handling patterns such as logging to external services, sending notifications, or recording metrics when operations fail.
All operations run on the failure track - they only execute when the Result has failed.
Methods
TapOnFailureAsync<TValue>(Result<TValue>, Func<Error, Task>)
Asynchronously executes the given async action with the error if the result is a failure. Returns the original result unchanged.
[RailwayTrack(TrackBehavior.Failure)]
public static Task<Result<TValue>> TapOnFailureAsync<TValue>(this Result<TValue> result, Func<Error, Task> func)
Parameters
resultResult<TValue>The result to tap.
funcFunc<Error, Task>The async action to execute with the error if the result is a failure.
Returns
Type Parameters
TValueType of the result value.
TapOnFailureAsync<TValue>(Result<TValue>, Func<Error, ValueTask>)
Asynchronously executes the given async action with the error if the result is a failure. Returns the original result unchanged.
[RailwayTrack(TrackBehavior.Failure)]
public static ValueTask<Result<TValue>> TapOnFailureAsync<TValue>(this Result<TValue> result, Func<Error, ValueTask> func)
Parameters
resultResult<TValue>The result to tap.
funcFunc<Error, ValueTask>The async action to execute with the error if the result is a failure.
Returns
Type Parameters
TValueType of the result value.
TapOnFailureAsync<TValue>(Result<TValue>, Func<Task>)
Asynchronously executes the given async action if the result is a failure. Returns the original result unchanged.
[RailwayTrack(TrackBehavior.Failure)]
public static Task<Result<TValue>> TapOnFailureAsync<TValue>(this Result<TValue> result, Func<Task> func)
Parameters
resultResult<TValue>The result to tap.
funcFunc<Task>The async action to execute if the result is a failure.
Returns
Type Parameters
TValueType of the result value.
TapOnFailureAsync<TValue>(Result<TValue>, Func<ValueTask>)
Asynchronously executes the given async action if the result is a failure. Returns the original result unchanged.
[RailwayTrack(TrackBehavior.Failure)]
public static ValueTask<Result<TValue>> TapOnFailureAsync<TValue>(this Result<TValue> result, Func<ValueTask> func)
Parameters
resultResult<TValue>The result to tap.
funcFunc<ValueTask>The async action to execute if the result is a failure.
Returns
Type Parameters
TValueType of the result value.
TapOnFailureAsync<TValue>(Task<Result<TValue>>, Action)
Asynchronously executes the given action if the result is a failure. Returns the original result unchanged.
[RailwayTrack(TrackBehavior.Failure)]
public static Task<Result<TValue>> TapOnFailureAsync<TValue>(this Task<Result<TValue>> resultTask, Action action)
Parameters
resultTaskTask<Result<TValue>>The task containing the result to tap.
actionActionThe action to execute if the result is a failure.
Returns
Type Parameters
TValueType of the result value.
TapOnFailureAsync<TValue>(Task<Result<TValue>>, Action<Error>)
Asynchronously executes the given action with the error if the result is a failure. Returns the original result unchanged.
[RailwayTrack(TrackBehavior.Failure)]
public static Task<Result<TValue>> TapOnFailureAsync<TValue>(this Task<Result<TValue>> resultTask, Action<Error> action)
Parameters
resultTaskTask<Result<TValue>>The task containing the result to tap.
actionAction<Error>The action to execute with the error if the result is a failure.
Returns
Type Parameters
TValueType of the result value.
TapOnFailureAsync<TValue>(Task<Result<TValue>>, Func<Error, Task>)
Asynchronously executes the given async action with the error if the result is a failure. Returns the original result unchanged.
[RailwayTrack(TrackBehavior.Failure)]
public static Task<Result<TValue>> TapOnFailureAsync<TValue>(this Task<Result<TValue>> resultTask, Func<Error, Task> func)
Parameters
resultTaskTask<Result<TValue>>The task containing the result to tap.
funcFunc<Error, Task>The async action to execute with the error if the result is a failure.
Returns
Type Parameters
TValueType of the result value.
TapOnFailureAsync<TValue>(Task<Result<TValue>>, Func<Task>)
Asynchronously executes the given async action if the result is a failure. Returns the original result unchanged.
[RailwayTrack(TrackBehavior.Failure)]
public static Task<Result<TValue>> TapOnFailureAsync<TValue>(this Task<Result<TValue>> resultTask, Func<Task> func)
Parameters
resultTaskTask<Result<TValue>>The task containing the result to tap.
funcFunc<Task>The async action to execute if the result is a failure.
Returns
Type Parameters
TValueType of the result value.
TapOnFailureAsync<TValue>(ValueTask<Result<TValue>>, Action)
Asynchronously executes the given action if the result is a failure. Returns the original result unchanged.
[RailwayTrack(TrackBehavior.Failure)]
public static ValueTask<Result<TValue>> TapOnFailureAsync<TValue>(this ValueTask<Result<TValue>> resultTask, Action action)
Parameters
resultTaskValueTask<Result<TValue>>The ValueTask containing the result to tap.
actionActionThe action to execute if the result is a failure.
Returns
Type Parameters
TValueType of the result value.
TapOnFailureAsync<TValue>(ValueTask<Result<TValue>>, Action<Error>)
Asynchronously executes the given action with the error if the result is a failure. Returns the original result unchanged.
[RailwayTrack(TrackBehavior.Failure)]
public static ValueTask<Result<TValue>> TapOnFailureAsync<TValue>(this ValueTask<Result<TValue>> resultTask, Action<Error> action)
Parameters
resultTaskValueTask<Result<TValue>>The ValueTask containing the result to tap.
actionAction<Error>The action to execute with the error if the result is a failure.
Returns
Type Parameters
TValueType of the result value.
TapOnFailureAsync<TValue>(ValueTask<Result<TValue>>, Func<Error, ValueTask>)
Asynchronously executes the given async action with the error if the result is a failure. Returns the original result unchanged.
[RailwayTrack(TrackBehavior.Failure)]
public static ValueTask<Result<TValue>> TapOnFailureAsync<TValue>(this ValueTask<Result<TValue>> resultTask, Func<Error, ValueTask> func)
Parameters
resultTaskValueTask<Result<TValue>>The ValueTask containing the result to tap.
funcFunc<Error, ValueTask>The async action to execute with the error if the result is a failure.
Returns
Type Parameters
TValueType of the result value.
TapOnFailureAsync<TValue>(ValueTask<Result<TValue>>, Func<ValueTask>)
Asynchronously executes the given async action if the result is a failure. Returns the original result unchanged.
[RailwayTrack(TrackBehavior.Failure)]
public static ValueTask<Result<TValue>> TapOnFailureAsync<TValue>(this ValueTask<Result<TValue>> resultTask, Func<ValueTask> func)
Parameters
resultTaskValueTask<Result<TValue>>The ValueTask containing the result to tap.
funcFunc<ValueTask>The async action to execute if the result is a failure.
Returns
Type Parameters
TValueType of the result value.