DbException class
Typed exceptions thrown by every dartapi_db driver.
All database errors surface as a DbException subclass, so application code can map them to HTTP responses without parsing driver messages:
try {
await db.insert('users', {'email': dto.email, ...});
} on UniqueViolationException {
throw const ApiException(409, 'Email already registered');
} on DbConnectionException {
throw const ApiException(503, 'Database unavailable');
}
The original driver exception is preserved in cause for logging and debugging.
- Implemented types
- Implementers
Constructors
- DbException(String message, {Object? cause})
-
const
Properties
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited