unwrapErrOr abstract method
- @useResult
- E defaultError
Returns the contained error, if any, or defaultError
otherwise.
Examples
// prints "other"
print(const Ok<int, String>(2).unwrapErrOr('other'));
// prints "error"
print(const Err<int, String>('error').unwrapErrOr('other'));
Implementation
@useResult
E unwrapErrOr(E defaultError);