const result: Result<number, string> = err("error");
const value = tapErr(result, (error) => {
console.log(error);
});
// "error" 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.
const result: Result<number, string> = err("error");
const value = tapErr(result, (error) => {
console.log(error);
});
// "error" gets logged by the callback;
result === value; // true
Tap into an
Errresult.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.