onError<R> method

FutureOr<R?> onError<R>(
  1. DataException e,
  2. DataRequestLabel? label
)
inherited

Implements global request error handling.

Defaults to throw e unless it is an HTTP 404 or an OfflineException.

NOTE: onError arguments throughout the API are used to override this default behavior.

Implementation

FutureOr<R?> onError<R>(
  DataException e,
  DataRequestLabel? label,
) {
  if (e.statusCode == 404 || e is OfflineException) {
    return null;
  }
  throw e;
}