DataException

class DataException(val reason: DataExceptionReason, sqlState: String, serverErrorMessage: ServerErrorMessage) : OctaviusException

Exception thrown when an operation fails due to invalid data values during execution.

Unlike syntax or definition errors, this occurs when the query structure is correct, but the runtime values (often parameters) cause an error. Examples include string truncation, numeric overflow, division by zero, or invalid text representation of a data type.

Parameters

sqlState

The SQL state code returned by the database.

serverErrorMessage

The original error message from the database server.

Constructors

Link copied to clipboard
constructor(reason: DataExceptionReason, sqlState: String, serverErrorMessage: ServerErrorMessage)

Properties

Link copied to clipboard
open val cause: Throwable?
Link copied to clipboard

The primary error message the database raised.

Link copied to clipboard

Additional, human-readable details provided by the database.

Link copied to clipboard
open val message: String?
Link copied to clipboard

Where this happened, innermost first, appended to by each layer as the exception unwinds. It is on the base class for the same reason queryContext is: adding to it is the only thing a frame can do to an exception without replacing it, and replacing one costs the type the caller catches on - a ConstraintViolationException restated as something else stops being the failure a retry looks for. A mapper walking a nested composite appends the attribute it was on, a transaction plan the step and parameter it was resolving. Rendered reversed, outermost first, so PATH: step 1 -> parameter 'name' -> map #1 reads from the plan down to the lambda.

Link copied to clipboard

The context of the query that resulted in this exception, if applicable.

Link copied to clipboard

The specific reason for the data error.

Link copied to clipboard

The raw error message received from the database, if applicable.

Link copied to clipboard

The SQL state code associated with the error, if applicable.

Link copied to clipboard

The call stack the error arose in, for one raised inside a trigger or function.

Functions

Link copied to clipboard

Finds the Octavius failure behind this throwable, if there is one.

Link copied to clipboard
open override fun getDetailedMessage(): String

Provides a detailed, human-readable description of the error.

Link copied to clipboard
open override fun toString(): String