|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.h2.message.DbException
public class DbException
This exception wraps a checked exception. It is used in methods where checked exceptions are not supported, for example in a Comparator.
Method Summary | |
---|---|
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 |
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.Exception e)
Convert an exception to a SQL exception using the default mapping. |
Methods inherited from class java.lang.Throwable |
---|
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public java.sql.SQLException getSQLException()
public int getErrorCode()
public DbException addSQL(java.lang.String sql)
sql
- the SQL statement
public static DbException get(int errorCode)
errorCode
- the error code
public static DbException get(int errorCode, java.lang.String p1)
errorCode
- the error codep1
- the first parameter of the message
public 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 message
public static DbException get(int errorCode, java.lang.String... params)
errorCode
- the error codeparams
- the list of parameters of the message
public static DbException getSyntaxError(java.lang.String sql, int index)
sql
- the SQL statementindex
- the position of the error in the SQL statement
public 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 message
public static DbException getUnsupportedException(java.lang.String message)
message
- what exactly is not supported
public static DbException getInvalidValueException(java.lang.String param, java.lang.Object value)
param
- the name of the parametervalue
- the value passed
public static java.lang.RuntimeException throwInternalError(java.lang.String s)
s
- the message
java.lang.RuntimeException
- the exceptionpublic static java.lang.RuntimeException throwInternalError()
public static java.sql.SQLException toSQLException(java.lang.Exception e)
e
- the root cause
public static DbException convert(java.lang.Throwable e)
e
- the root cause
public static DbException convertInvocation(java.lang.reflect.InvocationTargetException te, java.lang.String message)
te
- the root causemessage
- the added message or null
public static DbException convertIOException(java.io.IOException e, java.lang.String message)
e
- the root causemessage
- the message or null
public static java.io.IOException convertToIOException(java.lang.Throwable e)
e
- the root cause
public java.lang.Object getSource()
public void setSource(java.lang.Object source)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |