Class DatabaseException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
jakarta.persistence.PersistenceException
google.registry.persistence.transaction.DatabaseException
- All Implemented Interfaces:
Serializable
public class DatabaseException
extends jakarta.persistence.PersistenceException
Wraps an exception thrown by the JPA framework and captures the SQL error details (state and
status code) in the
message
.
The SQLException
class has its own chain of exceptions that describe multiple error
conditions encontered during a transaction. A typical logger relying on the chain of causes
in Throwable
instances cannot capture all details
of errors thrown from the database drivers. This exception captures all error details in its
message text.
The TransactionManager
wraps every persistence exception in an instance of this class.
This allows us to disable logging in specific Hibernate classes that logs at ERROR
-level
and rethrows. These ERROR
logs are misleading, since the impacted transactions often
succeeds on retries.
See the logging.properties
files in the env
package for the specific Hibernate
classes that have logging suppressed.
- See Also:
-
Method Summary
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Method Details
-
getMessage
- Overrides:
getMessage
in classThrowable
-