getOrThrow method

T getOrThrow()

Returns the success value or throws the failure error. Intended for tests and explicit adapter boundaries (mirrors pi's getOrThrow).

Implementation

T getOrThrow() => switch (this) {
  Ok<T, E>(:final value) => value,
  Err<T, E>(:final error) => throw error as Object,
};