mapError<F> method
- F mapper(
- E error
Transforms the error value of type E into a new error of type F
using the provided mapper function.
If this object contains a value, the value is passed along unmodified.
Implementation
Expected<T, F> mapError<F>(F Function(E error) mapper) {
if (!_hasValue) {
return Expected<T, F>.error(mapper(_error as E));
} else {
return Expected<T, F>.value(_value as T);
}
}