public class QueryExceptionHandler extends Object
SQLException thrown when executing a JDBC
method.
The methods in this class can be used for example to tell whether an exception is retryable, or more in particular
if it is a timeout (which can also be considered retryable).| Constructor and Description |
|---|
QueryExceptionHandler() |
| Modifier and Type | Method and Description |
|---|---|
DatabaseEngineException |
handleException(Exception exception,
String message)
Handles the Exception, disambiguating it into a specific PDB Exception and throwing it.
|
boolean |
isRetryableException(SQLException exception)
Checks if an Exception occurred due to serialization failures in concurrent transactions and may be retried on
the client-side.
|
boolean |
isTimeoutException(SQLException exception)
Indicates if a given exception is a timeout.
|
boolean |
isUniqueConstraintViolationException(SQLException exception)
Checks if an Exception occurred due to a unique constraint violation.
|
public boolean isTimeoutException(SQLException exception)
exception - The exception to check.true if the exception is a timeout, false otherwise.public boolean isRetryableException(SQLException exception)
exception - The exception to check.true if the exception is retryable, false otherwise.public boolean isUniqueConstraintViolationException(SQLException exception)
exception - The exception to check.true if the exception is a unique constraint violation, false otherwise.public DatabaseEngineException handleException(Exception exception, String message) throws DatabaseEngineException
If a specific type does not match the info in the provided Exception, throws a DatabaseEngineException.
exception - The exception to handle.message - The message to associate with the thrown exception.DatabaseEngineException (declared, but only to keep Java type system happy; this method will
always throw an exception).DatabaseEngineExceptionCopyright © 2023 Feedzai. All rights reserved.