wrap abstract method

Object? wrap(
  1. Object error,
  2. StackTrace stackTrace,
  3. ReduxAction<St> action
)

This method is deprecated in favor of GlobalWrapError.wrap.

The reason for this deprecation is that the GlobalWrapError works in the same way as the action's ReduxAction.wrapError, while WrapError does not.

The difference is that when WrapError returns null, the original error is not modified, while with GlobalWrapError returning null will instead disable the error.

In other words, where your old WrapError returned null, your new GlobalWrapError should return the original error:

// WrapError (deprecated):
Object? wrap(error, stackTrace, action) {
   if (error is MyException) return null; // Keep the error unaltered.
   else return processError(error);
}

// GlobalWrapError:
Object? wrap(error, stackTrace, action) {
   if (error is MyException) return error; // Keep the error unaltered.
   else return processError(error);
}

Also note, GlobalWrapError is more powerful because it can disable the error, whereas WrapError cannot.

Implementation

Object? wrap(
  Object error,
  StackTrace stackTrace,
  ReduxAction<St> action,
);