isRecoverable static method

bool isRecoverable(
  1. YamuxException exception
)

Determines if a Yamux exception represents a recoverable error

Implementation

static bool isRecoverable(YamuxException exception) {
  // Stream state exceptions are generally not recoverable at the stream level
  if (exception is YamuxStreamStateException) {
    return false;
  }

  // Timeout exceptions might be recoverable with retry
  if (exception is YamuxStreamTimeoutException) {
    return true;
  }

  // Some protocol exceptions might be recoverable
  if (exception is YamuxStreamProtocolException) {
    // Socket errors are usually not recoverable
    if (exception.protocolError == 'socket_error') {
      return false;
    }
    // Format errors are usually not recoverable
    if (exception.protocolError == 'format_error') {
      return false;
    }
    // Unknown errors - be conservative
    return false;
  }

  // Session exceptions are generally not recoverable
  return false;
}