in core/src/main/java/com/datastax/oss/driver/internal/core/cql/CqlPrepareHandler.java [397:428]
private void processErrorResponse(Error errorMessage) {
if (errorMessage.code == ProtocolConstants.ErrorCode.UNPREPARED
|| errorMessage.code == ProtocolConstants.ErrorCode.ALREADY_EXISTS
|| errorMessage.code == ProtocolConstants.ErrorCode.READ_FAILURE
|| errorMessage.code == ProtocolConstants.ErrorCode.READ_TIMEOUT
|| errorMessage.code == ProtocolConstants.ErrorCode.WRITE_FAILURE
|| errorMessage.code == ProtocolConstants.ErrorCode.WRITE_TIMEOUT
|| errorMessage.code == ProtocolConstants.ErrorCode.UNAVAILABLE
|| errorMessage.code == ProtocolConstants.ErrorCode.TRUNCATE_ERROR) {
setFinalError(
new IllegalStateException(
"Unexpected server error for a PREPARE query" + errorMessage));
return;
}
CoordinatorException error = Conversions.toThrowable(node, errorMessage, context);
if (error instanceof BootstrappingException) {
LOG.trace("[{}] {} is bootstrapping, trying next node", logPrefix, node);
recordError(node, error);
sendRequest(request, null, retryCount);
} else if (error instanceof QueryValidationException
|| error instanceof FunctionFailureException
|| error instanceof ProtocolError) {
LOG.trace("[{}] Unrecoverable error, rethrowing", logPrefix);
setFinalError(error);
} else {
// Because prepare requests are known to always be idempotent, we call the retry policy
// directly, without checking the flag.
RetryPolicy retryPolicy = Conversions.resolveRetryPolicy(context, executionProfile);
RetryVerdict verdict = retryPolicy.onErrorResponseVerdict(request, error, retryCount);
processRetryVerdict(verdict, error);
}
}