Package oracle.soda
Class OracleException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- oracle.soda.OracleException
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
OracleBatchException
public class OracleException extends Exception
A general exception thrown by various methods of this API. It can have other exceptions as causes (for example, in case of an RDBMS implementation, anOracleException
could have aSQLException
as a cause).Note: cause exceptions are subject to change in the future. Your application code should avoid relying on them.
Certain API operations might provide multiple exceptions. For example, for the Oracle RDBMS implementation of SODA, insert statements might generate multiple SQL exceptions wrapped in SODA exceptions. In these cases, the additional exceptions are accessible via
getNextException()
. The exception returned bygetNextException()
might, in turn, have another exception chained to it. Thus, in order to access all exceptions in the chain, an application can recursively invokegetNextException()
until anull
value is returned.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static int
UNKNOWN_ERROR_CODE
-
Constructor Summary
Constructors Constructor Description OracleException(String message)
Constructs anOracleException
object with a given message.OracleException(String message, int errorCode)
Constructs anOracleException
with a given message and an error code.OracleException(String message, Throwable cause, int errorCode)
Constructs anOracleException
with a given message, cause, error code, and error prefix.OracleException(Throwable cause)
Constructs anOracleException
with a specified cause (for example, aSQLException
or anIOException
).OracleException(Throwable cause, int errorCode)
Constructs anOracleException
with a specified cause (for example, aSQLException
or anIOException
).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getErrorCode()
Returns the error code associated with this exception.OracleException
getNextException()
Returns the next OracleException in the chain ornull
if none.void
setNextException(OracleException nextException)
Adds anOracleException
to the chain of exceptions.-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Field Detail
-
UNKNOWN_ERROR_CODE
public static final int UNKNOWN_ERROR_CODE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
OracleException
public OracleException(String message)
Constructs anOracleException
object with a given message.- Parameters:
message
- the description of the error.null
indicates that the message string is non-existant
-
OracleException
public OracleException(Throwable cause)
Constructs anOracleException
with a specified cause (for example, aSQLException
or anIOException
).- Parameters:
cause
- the cause
-
OracleException
public OracleException(Throwable cause, int errorCode)
Constructs anOracleException
with a specified cause (for example, aSQLException
or anIOException
).- Parameters:
cause
- the causeerrorCode
- integer error code
-
OracleException
public OracleException(String message, int errorCode)
Constructs anOracleException
with a given message and an error code.- Parameters:
message
- the description of the error.null
indicates that the message string is non-existanterrorCode
- the error code
-
OracleException
public OracleException(String message, Throwable cause, int errorCode)
Constructs anOracleException
with a given message, cause, error code, and error prefix.- Parameters:
message
- the description of the error.null
indicates that the message string is non-existantcause
- the causeerrorCode
- the error code
-
-
Method Detail
-
getErrorCode
public int getErrorCode()
Returns the error code associated with this exception. If the exception wraps aSQLException
, the SQL error code is returned. Otherwise the error code provided during construction is returned. If no error code was provided during construction either,OracleException.UNKNOWN_ERROR_CODE
is returned.- Returns:
- the error code
-
getNextException
public OracleException getNextException()
Returns the next OracleException in the chain ornull
if none.- Returns:
- the next exception,
null
if none
-
setNextException
public void setNextException(OracleException nextException)
Adds anOracleException
to the chain of exceptions.- Parameters:
nextException
- the exception
-
-