err<T> static method

Problem err<T>(
  1. Result<T> result, {
  2. String? reason,
})

Asserts result is a Err and returns its problem.

Implementation

static Problem err<T>(Result<T> result, {String? reason}) => result.match(
  ok: (T value) =>
      throw AuthAssertionError(reason ?? 'expected Err but got Ok($value)'),
  err: (Problem problem) => problem,
);