public class DbException
extends java.lang.RuntimeException
| Modifier and Type | Method and Description |
|---|---|
DbException |
addSQL(java.lang.String sql)
Set the SQL statement of the given exception.
|
static DbException |
convert(java.lang.Throwable e)
Convert a throwable to an SQL exception using the default mapping.
|
static DbException |
convertInvocation(java.lang.reflect.InvocationTargetException te,
java.lang.String message)
Convert an InvocationTarget exception to a database exception.
|
static DbException |
convertIOException(java.io.IOException e,
java.lang.String message)
Convert an IO exception to a database exception.
|
static java.io.IOException |
convertToIOException(java.lang.Throwable e)
Convert an exception to an IO exception.
|
static DbException |
fromUser(java.lang.String sqlstate,
java.lang.String message)
Create a database exception for an arbitrary SQLState.
|
static DbException |
get(int errorCode)
Create a database exception for a specific error code.
|
static DbException |
get(int errorCode,
java.lang.String... params)
Create a database exception for a specific error code.
|
static DbException |
get(int errorCode,
java.lang.String p1)
Create a database exception for a specific error code.
|
static DbException |
get(int errorCode,
java.lang.Throwable cause,
java.lang.String... params)
Create a database exception for a specific error code.
|
int |
getErrorCode()
Get the error code.
|
static DbException |
getInvalidValueException(java.lang.String param,
java.lang.Object value)
Gets a SQL exception meaning this value is invalid.
|
java.lang.Object |
getSource() |
java.sql.SQLException |
getSQLException()
Get the SQLException object.
|
static DbException |
getSyntaxError(java.lang.String sql,
int index)
Create a syntax error exception.
|
static DbException |
getSyntaxError(java.lang.String sql,
int index,
java.lang.String message)
Create a syntax error exception.
|
static DbException |
getUnsupportedException(java.lang.String message)
Gets a SQL exception meaning this feature is not supported.
|
void |
setSource(java.lang.Object source) |
static java.lang.RuntimeException |
throwInternalError()
Throw an internal error.
|
static java.lang.RuntimeException |
throwInternalError(java.lang.String s)
Throw an internal error.
|
static java.sql.SQLException |
toSQLException(java.lang.Throwable e)
Convert an exception to a SQL exception using the default mapping.
|
static void |
traceThrowable(java.lang.Throwable e)
Write the exception to the driver manager log writer if configured.
|
public java.sql.SQLException getSQLException()
public int getErrorCode()
public DbException addSQL(java.lang.String sql)
sql - the SQL statementpublic static DbException get(int errorCode)
errorCode - the error codepublic static DbException get(int errorCode, java.lang.String p1)
errorCode - the error codep1 - the first parameter of the messagepublic static DbException get(int errorCode, java.lang.Throwable cause, java.lang.String... params)
errorCode - the error codecause - the cause of the exceptionparams - the list of parameters of the messagepublic static DbException get(int errorCode, java.lang.String... params)
errorCode - the error codeparams - the list of parameters of the messagepublic static DbException fromUser(java.lang.String sqlstate, java.lang.String message)
sqlstate - the state to usemessage - the message to usepublic static DbException getSyntaxError(java.lang.String sql, int index)
sql - the SQL statementindex - the position of the error in the SQL statementpublic static DbException getSyntaxError(java.lang.String sql, int index, java.lang.String message)
sql - the SQL statementindex - the position of the error in the SQL statementmessage - the messagepublic static DbException getUnsupportedException(java.lang.String message)
message - what exactly is not supportedpublic static DbException getInvalidValueException(java.lang.String param, java.lang.Object value)
param - the name of the parametervalue - the value passedpublic static java.lang.RuntimeException throwInternalError(java.lang.String s)
s - the messagejava.lang.RuntimeException - the exceptionpublic static java.lang.RuntimeException throwInternalError()
public static java.sql.SQLException toSQLException(java.lang.Throwable e)
e - the root causepublic static DbException convert(java.lang.Throwable e)
e - the root causepublic static DbException convertInvocation(java.lang.reflect.InvocationTargetException te, java.lang.String message)
te - the root causemessage - the added message or nullpublic static DbException convertIOException(java.io.IOException e, java.lang.String message)
e - the root causemessage - the message or nullpublic static java.io.IOException convertToIOException(java.lang.Throwable e)
e - the root causepublic java.lang.Object getSource()
public void setSource(java.lang.Object source)
public static void traceThrowable(java.lang.Throwable e)
e - the exception