Class PGExceptionFactory (0.18.2)

public class PGExceptionFactory

Factory class for PGException instances.

Inheritance

java.lang.Object > PGExceptionFactory

Static Methods

<T>checkArgument(T value, boolean valid, String message)

public static T <T>checkArgument(T value, boolean valid, String message)

Throws a PGException with the given message and SQLState#InvalidParameterValue if valid is false. Otherwise, returns the given value.

Parameters
NameDescription
valueT
validboolean
messageString
Returns
TypeDescription
T

newPGException(String message)

public static PGException newPGException(String message)
Parameter
NameDescription
messageString
Returns
TypeDescription
PGException

newPGException(String message, SQLState sqlState)

public static PGException newPGException(String message, SQLState sqlState)

Creates a basic PGException with Severity#ERROR and the specified SQLState.

Parameters
NameDescription
messageString
sqlStateSQLState
Returns
TypeDescription
PGException

newQueryCancelledException()

public static PGException newQueryCancelledException()

Creates a new exception that indicates that the current query was cancelled by the client.

Returns
TypeDescription
PGException

newTransactionAbortedException()

public static PGException newTransactionAbortedException()

Creates a new exception that indicates that the current transaction is in the aborted state.

Returns
TypeDescription
PGException

toPGException(SpannerException spannerException)

public static PGException toPGException(SpannerException spannerException)

Converts the given SpannerException to a PGException.

Parameter
NameDescription
spannerExceptioncom.google.cloud.spanner.SpannerException
Returns
TypeDescription
PGException

toPGException(Throwable throwable)

public static PGException toPGException(Throwable throwable)

Converts the given Exception to a PGException.

Parameter
NameDescription
throwableThrowable
Returns
TypeDescription
PGException