Package oracle.soda

Class 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, an OracleException could have a SQLException 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 by getNextException() might, in turn, have another exception chained to it. Thus, in order to access all exceptions in the chain, an application can recursively invoke getNextException() until a null value is returned.

    See Also:
    Serialized Form
    • Constructor Detail

      • OracleException

        public OracleException​(String message)
        Constructs an OracleException 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 an OracleException with a specified cause (for example, a SQLException or an IOException).
        Parameters:
        cause - the cause
      • OracleException

        public OracleException​(Throwable cause,
                               int errorCode)
        Constructs an OracleException with a specified cause (for example, a SQLException or an IOException).
        Parameters:
        cause - the cause
        errorCode - integer error code
      • OracleException

        public OracleException​(String message,
                               int errorCode)
        Constructs an OracleException with a given message and an error code.
        Parameters:
        message - the description of the error. null indicates that the message string is non-existant
        errorCode - the error code
      • OracleException

        public OracleException​(String message,
                               Throwable cause,
                               int errorCode)
        Constructs an OracleException 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-existant
        cause - the cause
        errorCode - the error code
    • Method Detail

      • getErrorCode

        public int getErrorCode()
        Returns the error code associated with this exception. If the exception wraps a SQLException, 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 or null if none.
        Returns:
        the next exception, null if none
      • setNextException

        public void setNextException​(OracleException nextException)
        Adds an OracleException to the chain of exceptions.
        Parameters:
        nextException - the exception