Class DataAPIException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.datastax.astra.client.exceptions.DataAPIException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
CursorException
,DataAPIHttpException
,DataAPIResponseException
,InvalidConfigurationException
,InvalidEnvironmentException
,TooManyDocumentsToCountException
,TooManyRowsToCountException
,UnexpectedDataAPIResponseException
Represents a runtime exception that occurs within the Data API client. This exception
is thrown to indicate a problem encountered while performing operations such as querying,
updating, or deleting data through the Data API. It acts as a wrapper for lower-level exceptions
to provide a more general fault indication to the client code.
This exception should be caught and handled by the client application to gracefully manage API-related errors, such as connectivity issues, data format mismatches, or unauthorized access attempts. It is recommended to log the details of this exception and present a user-friendly message to the end-user, if applicable.
Example usage:
try {
collection.insertOne(document);
} catch (DataApiException e) {
// Handle the exception, e.g., log it or display an error message
log.error("Error performing Data API operation: " + e.getMessage(), e);
}
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Default error code.static final String
Default error message.static final String
Default error code.static final String
Default error code.static final String
Default error code.static final String
Default error code.static final String
Default error code. -
Constructor Summary
ConstructorDescriptionDataAPIException
(ClientErrorCodes errorCode, String errorMessage) Constructors providing all arguments and a parent exception.DataAPIException
(String errorCode, String errorMessage) Constructors providing all arguments and a parent exception.DataAPIException
(String errorMessage, String errorCode, Throwable parent) Constructors providing all arguments and a parent exception. -
Method Summary
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Field Details
-
DEFAULT_ERROR_MESSAGE
Default error message.- See Also:
-
DEFAULT_ERROR_CODE
Default error code.- See Also:
-
ERROR_CODE_TIMEOUT
Default error code.- See Also:
-
ERROR_CODE_INTERRUPTED
Default error code.- See Also:
-
ERROR_CODE_RANDOM
Default error code.- See Also:
-
ERROR_CODE_HTTP
Default error code.- See Also:
-
ERROR_CODE_SERIALIZATION
Default error code.- See Also:
-
-
Constructor Details
-
DataAPIException
Constructors providing all arguments and a parent exception.- Parameters:
errorCode
- error codeerrorMessage
- error message
-
DataAPIException
Constructors providing all arguments and a parent exception.- Parameters:
errorCode
- error codeerrorMessage
- error message
-
DataAPIException
Constructors providing all arguments and a parent exception.- Parameters:
errorMessage
- error messageerrorCode
- error codeparent
- parent exception
-