onError method

  1. @override
Future onError(
  1. dynamic error,
  2. StackTrace stackTrace
)
override

Called when an error occurs during request processing

Can handle the error, modify it, or return a different error. If this method returns normally (doesn't throw), the returned value will be thrown as the final error.

error The error that occurred stackTrace The stack trace when the error occurred Returns the error to be thrown (can be modified or replaced)

Implementation

@override
Future<dynamic> onError(dynamic error, StackTrace stackTrace) async {
  if (logError) {
    developer.log(
      '✗ Error: $error',
      name: logTag,
      error: error,
      stackTrace: stackTrace,
    );
  }
  return error;
}