expect method

T expect(
  1. String message
)

Returns the held value of this Result if it is Ok. Throws a ResultError with the given message and held Err value if this Result is Err.

See also: Rust: Result::expect()

Implementation

T expect(String message) => switch (this) {
	Ok(value: T value) => value,
	Err(value: E value) => throw ResultError('$message: $value', isExpected: true)
};