mapError<E2> method

Exit<A, E2> mapError<E2>(
  1. E2 f(
    1. E
    )
)

Maps the error type of this exit

Implementation

Exit<A, E2> mapError<E2>(E2 Function(E) f) {
  return switch (this) {
    Success() => this as Exit<A, E2>,
    Failure(:final cause) => Failure(cause.map(f)),
  };
}