getOrThrow method

T getOrThrow()

Unwraps the data, throwing if there's an error.

Throws the AuthError if the response contains an error. Use this when you want to propagate errors as exceptions.

Example:

final session = await authClient.getSession().then((r) => r.getOrThrow());

Implementation

T getOrThrow() {
  if (error != null) {
    throw error!;
  }
  return data!;
}