pub enum Kind {
Show 43 variants
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,
}Expand description
The kinds of Error, one per PHP exception class.
Variants§
Database
Utopia\Database\Exception: any other failure.
Authorization
Exception\Authorization: the roles lack a permission.
Schema
Exception\Schema: a schema definition or a document breaks the rules
of its collection’s schema (the parent of Kind::Structure,
Kind::Type, Kind::Character, Kind::Truncate,
Kind::Index, Kind::Dependency, Kind::Limit and
Kind::Relationship).
Contention
Exception\Contention: the engine aborted a statement over a lock
conflict (a Kind::Transaction).
Mismatch
Exception\Mismatch: a resource exists with another definition (a
Kind::Duplicate).
Refused
Exception\Refused: an adapter reported, without an error, that it
did not apply a schema change.
Unconfirmed
Exception\Unconfirmed: a commit could not be confirmed, so its
writes may or may not be stored.
Character
Exception\Character: a value has characters the adapter cannot store.
Conflict
Exception\Conflict: the document changed after the request started.
Dependency
Exception\Dependency: an attribute is used by an index.
Duplicate
Exception\Duplicate: a collection, attribute, index or document exists.
Index
Exception\Index: an invalid index.
Limit
Exception\Limit: a limit (attributes, indexes, size, bounds) is reached.
NotFound
Exception\NotFound: a collection, attribute, index or document is missing.
Operator
Exception\Operator: an operator cannot apply.
Order
Exception\Order: an order or cursor attribute is unusable.
Query
Exception\Query: an invalid query.
Relationship
Exception\Relationship: an invalid relationship operation.
Restricted
Exception\Restricted: an onDelete: restrict relationship blocks a delete.
Structure
Exception\Structure: a document does not match its collection.
Timeout
Exception\Timeout: the statement exceeded the configured timeout.
Transaction
Exception\Transaction: a transaction could not start, commit or roll back.
Truncate
Exception\Truncate: a value is longer than its column.
Type
Exception\Type: a value of the wrong type for its column.
Unique
Exception\Unique: a unique index is violated (a Kind::Duplicate).
Pdo
PDOException: a driver error the adapter does not map.
TypeError
TypeError, raised by the engine on a wrong argument type.
ValueError
ValueError, raised by the engine on a wrong argument value.
Json
JsonException.
DivisionByZero
DivisionByZeroError, raised by the engine on a division or modulo by zero.
Exception
Exception: PHP’s base exception, thrown by library code with new \Exception.
DateMalformedIntervalString
DateMalformedIntervalStringException: DateInterval rejected an
interval string (DateTime::addSeconds with PHP_INT_MIN seconds).
Error
Error: an engine error (using an object as an array, a string
offset that cannot be assigned or unset, …).
Runtime
RuntimeException: raised by a caller’s callback (a transaction’s
body, an onNext) and passed through.
Redis
RedisException: a Redis command of the Redis adapter failed outside
a transaction wrapper (phpredis’s exception, passed through).
Mongo
Utopia\Mongo\Exception: a MongoDB failure the Mongo adapter does
not map (passed through from utopia-php/mongo).
MongoUnsent
Utopia\Mongo\UnsentException: a MongoDB command that never reached
the server (passed through from utopia-php/mongo).
MongoUnexpectedValue
MongoDB\Driver\Exception\UnexpectedValueException: PHP’s MongoDB
extension refused to encode a command (a key holding a null byte, a
string that is not UTF-8).
DateMalformedString
DateMalformedStringException: new DateTime($value) rejected a
date string.
InvalidArgument
InvalidArgumentException: an invalid argument (the integer
arithmetic of [crate::validator::big_int::BigInt], a profiler
capacity below 1, an invalid hook argument).
BadMethodCall
BadMethodCallException: a call the object cannot serve (a query
builder without an executor).
QueryValidation
Utopia\Query\Exception\ValidationException: a statement the query
library’s builder refused, passed through where PHP’s adapter does
not wrap it in a Kind::Query error (an upsert’s statement).
Utopia\Cache\Exception\Unavailable: the cache could not confirm
an operation (a versioned record that kept changing or is invalid,
a flush that failed), passed through from utopia-php/cache.
Implementations§
Source§impl Kind
impl Kind
Sourcepub fn from_php_class(class: &str) -> Option<Kind>
pub fn from_php_class(class: &str) -> Option<Kind>
The kind of errors of the PHP class class (the inverse of
Kind::php_class); None for a class no kind stands for.
Sourcepub fn parent(self) -> Option<Kind>
pub fn parent(self) -> Option<Kind>
The kind this kind’s PHP class extends, if it extends another
database exception: Unique and Mismatch extend
Kind::Duplicate, Contention extends Kind::Transaction,
Order and Operator extend Kind::Query, the schema violations
extend Kind::Schema, and every other Exception\* extends
Kind::Database.
Trait Implementations§
impl Copy for Kind
impl Eq for Kind
impl StructuralPartialEq for Kind
Auto Trait Implementations§
impl Forget for Kind
impl Freeze for Kind
impl Move for Kind
impl RefUnwindSafe for Kind
impl Send for Kind
impl Sync for Kind
impl Unpin for Kind
impl UnsafeUnpin for Kind
impl UnwindSafe for Kind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.