com.almworks.sqlite4java
Class SQLiteException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by com.almworks.sqlite4java.SQLiteException
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
SQLiteBusyException, SQLiteInterruptedException

public class SQLiteException
extends java.lang.Exception

SQLiteException is thrown whenever SQLite cannot execute an operation and returns an error code.

Error codes can be compared against SQLiteConstants.

It's safe to rollback the transaction when SQLiteException is caught.

Author:
Igor Sereda
See Also:
Serialized Form

Constructor Summary
SQLiteException(int errorCode, java.lang.String errorMessage)
          Creates an instance of SQLiteException.
SQLiteException(int errorCode, java.lang.String errorMessage, java.lang.Throwable cause)
          Creates an instance of SQLiteException.
 
Method Summary
 int getBaseErrorCode()
          Gets base error code returned by SQLite.
 int getErrorCode()
          Gets the error code returned by SQLite.
 
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
 

Constructor Detail

SQLiteException

public SQLiteException(int errorCode,
                       java.lang.String errorMessage)
Creates an instance of SQLiteException.

Parameters:
errorCode - codes are defined in SQLiteConstants
errorMessage - optional error message

SQLiteException

public SQLiteException(int errorCode,
                       java.lang.String errorMessage,
                       java.lang.Throwable cause)
Creates an instance of SQLiteException.

Parameters:
errorCode - codes are defined in SQLiteConstants
errorMessage - optional error message
cause - error cause
Method Detail

getErrorCode

public int getErrorCode()
Gets the error code returned by SQLite.

Returns:
error code

getBaseErrorCode

public int getBaseErrorCode()
Gets base error code returned by SQLite. Base error code is the lowest 8 bit from the extended error code, like SQLITE_IOERR_BLOCKED.

Returns:
error code