public class DbException extends RuntimeException
| Modifier and Type | Method and Description |
|---|---|
DbException |
addSQL(String sql)
Set the SQL statement of the given exception.
|
static DbException |
convert(Throwable e)
Convert a throwable to an SQL exception using the default mapping.
|
static DbException |
convertInvocation(InvocationTargetException te,
String message)
Convert an InvocationTarget exception to a database exception.
|
static DbException |
convertIOException(IOException e,
String message)
Convert an IO exception to a database exception.
|
static IOException |
convertToIOException(Throwable e)
Convert an exception to an IO exception.
|
static DbException |
get(int errorCode)
Create a database exception for a specific error code.
|
static DbException |
get(int errorCode,
String... params)
Create a database exception for a specific error code.
|
static DbException |
get(int errorCode,
String p1)
Create a database exception for a specific error code.
|
static DbException |
get(int errorCode,
Throwable cause,
String... params)
Create a database exception for a specific error code.
|
int |
getErrorCode()
Get the error code.
|
static DbException |
getInvalidValueException(String param,
Object value)
Gets a SQL exception meaning this value is invalid.
|
Object |
getSource() |
SQLException |
getSQLException()
Get the SQLException object.
|
static DbException |
getSyntaxError(String sql,
int index)
Create a syntax error exception.
|
static DbException |
getSyntaxError(String sql,
int index,
String expected)
Create a syntax error exception.
|
static DbException |
getUnsupportedException(String message)
Gets a SQL exception meaning this feature is not supported.
|
void |
setSource(Object source) |
static RuntimeException |
throwInternalError()
Throw an internal error.
|
static RuntimeException |
throwInternalError(String s)
Throw an internal error.
|
static SQLException |
toSQLException(Exception e)
Convert an exception to a SQL exception using the default mapping.
|
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringpublic SQLException getSQLException()
public int getErrorCode()
public DbException addSQL(String sql)
sql - the SQL statementpublic static DbException get(int errorCode)
errorCode - the error codepublic static DbException get(int errorCode, String p1)
errorCode - the error codep1 - the first parameter of the messagepublic static DbException get(int errorCode, Throwable cause, String... params)
errorCode - the error codecause - the cause of the exceptionparams - the list of parameters of the messagepublic static DbException get(int errorCode, String... params)
errorCode - the error codeparams - the list of parameters of the messagepublic static DbException getSyntaxError(String sql, int index)
sql - the SQL statementindex - the position of the error in the SQL statementpublic static DbException getSyntaxError(String sql, int index, String expected)
sql - the SQL statementindex - the position of the error in the SQL statementexpected - the expected keyword at the given positionpublic static DbException getUnsupportedException(String message)
message - what exactly is not supportedpublic static DbException getInvalidValueException(String param, Object value)
param - the name of the parametervalue - the value passedpublic static RuntimeException throwInternalError(String s)
s - the messageRuntimeException - the exceptionpublic static RuntimeException throwInternalError()
public static SQLException toSQLException(Exception e)
e - the root causepublic static DbException convert(Throwable e)
e - the root causepublic static DbException convertInvocation(InvocationTargetException te, String message)
te - the root causemessage - the added message or nullpublic static DbException convertIOException(IOException e, String message)
e - the root causemessage - the message or nullpublic static IOException convertToIOException(Throwable e)
e - the root causepublic Object getSource()
public void setSource(Object source)
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.