mapErr method
Transforms the inner Err instance if this is an Err.
Implementation
@override
@pragma('vm:prefer-inline')
Err<T> mapErr(@noFutures Err<T> Function(Err<T> err) noFutures) {
// Absorb throws from the user callback so `Err.mapErr` honours the
// package-wide "no throws outside @unsafeOrError" contract. `on Err
// catch` preserves a user-thrown `Err` verbatim — statusCode and
// breadcrumbs survive intact.
try {
return noFutures(this);
} on Err catch (err) {
return err.transfErr<T>();
} catch (error, stackTrace) {
return Err<T>(error, stackTrace: stackTrace);
}
}