expectErr method
Expects the snapshot to be an Error and returns the error. Throws a StateError if the snapshot is not an Error.
Example:
err<int>(Exception('test')).expectErr(); // Exception('test')
ok(42).expectErr(); // throws StateError
Implementation
Object expectErr() {
if (!isErr()) {
throw StateError('Value is not an Error');
}
return error!;
}