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 (!_shouldRetry(error)) {
    return error;
  }

  // This would need to be implemented with access to the client
  // For now, we'll return the error as-is
  return error;
}