closeWithError method

Future<void> closeWithError(
  1. dynamic error, [
  2. StackTrace? stackTrace
])

Implementation

Future<void> closeWithError(dynamic error, [StackTrace? stackTrace]) async {
  _logger.fine('[UDXSessionConn $id] closeWithError called with error: $error');
  if (!_isClosed && !_isClosing) {
      _connManager.updateState(this, ConnectionState.closing, error: error);
  }

  if (!_closedCompleter.isCompleted) {
      _logger.fine('[UDXSessionConn $id] Completing close completer with error: $error');
      _closedCompleter.completeError(error, stackTrace);
  }
  await close();
}