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, anOracleExceptioncould have aSQLExceptionas 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 anullvalue is returned.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static intUNKNOWN_ERROR_CODE
-
Constructor Summary
Constructors Constructor Description OracleException(String message)Constructs anOracleExceptionobject with a given message.OracleException(String message, int errorCode)Constructs anOracleExceptionwith a given message and an error code.OracleException(String message, Throwable cause, int errorCode)Constructs anOracleExceptionwith a given message, cause, error code, and error prefix.OracleException(Throwable cause)Constructs anOracleExceptionwith a specified cause (for example, aSQLExceptionor anIOException).OracleException(Throwable cause, int errorCode)Constructs anOracleExceptionwith a specified cause (for example, aSQLExceptionor anIOException).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetErrorCode()Returns the error code associated with this exception.OracleExceptiongetNextException()Returns the next OracleException in the chain ornullif none.voidsetNextException(OracleException nextException)Adds anOracleExceptionto 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 anOracleExceptionobject with a given message.- Parameters:
message- the description of the error.nullindicates that the message string is non-existant
-
OracleException
public OracleException(Throwable cause)
Constructs anOracleExceptionwith a specified cause (for example, aSQLExceptionor anIOException).- Parameters:
cause- the cause
-
OracleException
public OracleException(Throwable cause, int errorCode)
Constructs anOracleExceptionwith a specified cause (for example, aSQLExceptionor anIOException).- Parameters:
cause- the causeerrorCode- integer error code
-
OracleException
public OracleException(String message, int errorCode)
Constructs anOracleExceptionwith a given message and an error code.- Parameters:
message- the description of the error.nullindicates that the message string is non-existanterrorCode- the error code
-
OracleException
public OracleException(String message, Throwable cause, int errorCode)
Constructs anOracleExceptionwith a given message, cause, error code, and error prefix.- Parameters:
message- the description of the error.nullindicates 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_CODEis returned.- Returns:
- the error code
-
getNextException
public OracleException getNextException()
Returns the next OracleException in the chain ornullif none.- Returns:
- the next exception,
nullif none
-
setNextException
public void setNextException(OracleException nextException)
Adds anOracleExceptionto the chain of exceptions.- Parameters:
nextException- the exception
-
-