@allynet/ishod
    Preparing search index...

    Function tapErr

    • Tap into an Err result.

      If the result is an Err, the function will be called with the error the result contains.

      Otherwise nothing will happen.

      It will not modify the result, and just return the original result.

      Type Parameters

      • T
      • E

      Parameters

      Returns Promise<Result<T, E>>

      const result: Result<number, string> = err("error");
      const value = tapErr(result, (error) => {
      console.log(error);
      });
      // "error" gets logged by the callback;
      result === value; // true
      const result: Result<number, string> = ok(1);
      const value = tapErr(result, (error) => {
      console.log(error);
      });
      // Nothing gets logged by the callback;
      result === value; // true
    • Tap into an Err result.

      If the result is an Err, the function will be called with the error the result contains.

      Otherwise nothing will happen.

      It will not modify the result, and just return the original result.

      Type Parameters

      • T
      • E

      Parameters

      Returns Result<T, E>

      const result: Result<number, string> = err("error");
      const value = tapErr(result, (error) => {
      console.log(error);
      });
      // "error" gets logged by the callback;
      result === value; // true
      const result: Result<number, string> = ok(1);
      const value = tapErr(result, (error) => {
      console.log(error);
      });
      // Nothing gets logged by the callback;
      result === value; // true