exception property

UseCaseException get exception

The failure exception. Throws StateError on a success.

Implementation

UseCaseException get exception => switch (this) {
      UseCaseFailure(:final value) => value,
      UseCaseSuccess() =>
        throw StateError('UseCase.exception called on a success'),
    };