Skip to main content

Kind

Enum Kind 

Source
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).

§

CacheUnavailable

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

Source

pub fn php_class(self) -> &'static str

The PHP class of errors of this kind.

Source

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.

Source

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§

Source§

impl Clone for Kind

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Kind

Source§

impl Debug for Kind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Kind

Source§

impl Hash for Kind

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Kind

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.