reportError method

  1. @override
void reportError(
  1. Object error,
  2. StackTrace stack, {
  3. String? action,
})
override

Reports an action that failed (its chain stopped).

Implementation

@override
void reportError(Object error, StackTrace stack, {String? action}) {
  try {
    if (onError != null) {
      onError!(error, stack, action);
    } else {
      _logError(error, stack, action);
    }
  } catch (callbackError, callbackStack) {
    // Reporting must not break another gesture or recursively report itself.
    _logError(callbackError, callbackStack, 'host_error_callback');
  }
  // The chain that just failed (the runner set it), if it can run again:
  // the error reaction's `retryFailed` runs it.
  final retry = failed.pending;
  failed.pending = null;
  failed.last = retry;
  try {
    onActionErrorEvent?.call(actionErrorEvent(error, action: action, retryable: retry != null));
  } catch (callbackError, callbackStack) {
    _logError(callbackError, callbackStack, 'action_error_callback');
  }
}