getOrThrow method

T getOrThrow()

The parsed value, throwing MintedFormatError when this failed. The only thing here that throws.

Beats getOrNull()!, which drops the typed reason this outcome is holding and leaves a bare null-check error in its place.

Implementation

T getOrThrow() => switch (this) {
  ParseSuccess(:final value) => value,
  ParseFailure(:final reason) => throw MintedFormatError.from(reason),
};