error
ModuleThe errors database operations fail with.
Contents
Type aliases
Result`Result` with `Error`.use utopia_database::Error;Rust
pub struct Error {
// private fields
}What a database operation failed with: a kind (one per PHP exception class), a message, and the integer code PHP's exception carries.
PHP: Utopia\Database\Exception and its subclasses in
Utopia\Database\Exception\*, plus the driver and engine exceptions that
escape the library unmapped (PDOException, TypeError, ...). The kind is
the class (Error::php_class); instanceof is Error::is_a (a
Kind::Unique error is also a Kind::Duplicate one, as Unique
extends Duplicate).
Also implements
Display, Error, From<EngineError>.use utopia_database::Kind;Rust
pub enum Kind {
Database,
Authorization,
Schema,
Contention,
Mismatch,
Refused,
Unconfirmed,
Character,
Conflict,
Dependency,
Duplicate,
Index,
Limit,
NotFound,
Operator,
Order,
Query,
Relationship,
Restricted,
Structure,
Timeout,
Transaction,
Truncate,
Type,
Unique,
Pdo,
TypeError,
ValueError,
Json,
DivisionByZero,
Exception,
DateMalformedIntervalString,
Error,
Runtime,
Redis,
Mongo,
MongoUnsent,
MongoUnexpectedValue,
DateMalformedString,
InvalidArgument,
BadMethodCall,
QueryValidation,
CacheUnavailable,
}The kinds of Error, one per PHP exception class.
Rust
pub type Result<T, E = Error> = Result<T, E>;Result with Error.
Rust
pub const UNIQUE_MESSAGE: &str = "Unique index violation";The message of every unique index violation (Exception\Unique::MESSAGE).