expectErr method
Returns the contained Err
(failure) value.
Throws an exception
Throws an exception if the value is an Ok
(success),
with the exception message including the passed message,
and the content of the Ok
value.
Examples
Result<int, String> x = Ok(9);
x.expectErr("Testing expectErr"); // throws an exception with `Testing expectErr: 9`
Implementation
@override
E expectErr(String message) {
return e;
}