replacePossibleError method
If the Result is a Err, then replaces internal err with result if given function oldErrorReplacer. Function oldErrorReplacer should take old error and return new error; And returns changed result; If the Result is a Ok, then return unchanged Result as is;
Implementation
Result<T> replacePossibleError(
Error Function(Error oldErr) oldErrorReplacer) {
if (isErr) {
return Err(oldErrorReplacer(_err!));
}
return this;
}