onFailure method

Future<NEResult<T>> onFailure(
  1. FutureOr action(
    1. int,
    2. String?
    )
)

Implementation

Future<NEResult<T>> onFailure(FutureOr Function(int, String?) action) async {
  return then<NEResult<T>>((value) async {
    if (!value.isSuccess()) {
      try {
        await action(value.code, value.msg);
      } catch (e, _) {
        assert(() {
          throw e;
        }());
      }
    }
    return value;
  });
}