toException method
Converts this cause to an exception that can be thrown
Implementation
Exception toException() {
return switch (this) {
Fail(:final error) => error is Exception
? error
: Exception('Effect failed with error: $error'),
Die(:final throwable) => throwable is Exception
? throwable
: Exception('Effect died with throwable: $throwable'),
};
}