/// <summary> /// Applies the <c>bind</c> function to the message of the given operation result if it doesn't match as a success. /// Otherwise the given operation result is passed on with the appropriate expected value type. /// </summary> /// <param name="source">The operation result to be processed.</param> /// <param name="bind">The function to be applied to the source result error message if it matches as an error or to the exception message if it matches as a failure.</param> /// <param name="getFailureMessage">A function used to extract the exception message from the result if it matches as a failure.</param> /// <typeparam name="T">The expected type of the source result value.</typeparam> /// <returns>A new operation result calculated based on the matching of the source result.</returns> public static IOperationResult <T> BindError <T>(this IOperationResult <T> source, Func <string, IOperationResult <T> > bind, Func <Exception, string> getFailureMessage) { return(source.BindError((_, error) => bind(error), getFailureMessage)); }