Enum bonsaidb::core::Error

pub enum Error {
Show 27 variants SchemaMismatch { database_name: String, schema: SchemaName, stored_schema: SchemaName, }, SchemaAlreadyRegistered(SchemaName), SchemaNotRegistered(SchemaName), ViewAlreadyRegistered(ViewName), InvalidDatabaseName(String), DatabaseNotFound(String), ViewNotFound, CollectionNotFound, ApiNotFound(ApiName), DatabaseNameAlreadyTaken(String), Networking(Error), CollectionAlreadyDefined, DocumentNotFound(CollectionName, Box<DocumentId, Global>), DocumentIdTooLong, DocumentConflict(CollectionName, Box<Header, Global>), UniqueKeyViolation { view: ViewName, conflicting_document: Box<Header, Global>, existing_document: Box<Header, Global>, }, DocumentPush(CollectionName, NextValueError), InvalidName(InvalidNameError), PermissionDenied(PermissionDenied), Password(String), UserNotFound, InvalidUnicode(String), InvalidCredentials, ReduceUnimplemented, NotANumber, Time(TimeError), Other { origin: String, error: String, },
}
Expand description

an enumeration of errors that this crate can produce

Variants§

§

SchemaMismatch

Fields

§database_name: String

The name of the database being accessed.

§schema: SchemaName

The schema provided for the database.

§stored_schema: SchemaName

The schema stored for the database.

The database named database_name was created with a different schema (stored_schema) than provided (schema).

§

SchemaAlreadyRegistered(SchemaName)

The SchemaName returned has already been registered.

§

SchemaNotRegistered(SchemaName)

The SchemaName requested was not registered.

§

ViewAlreadyRegistered(ViewName)

The ViewName returned has already been registered.

§

InvalidDatabaseName(String)

An invalid database name was specified. See StorageConnection::create_database() for database name requirements.

§

DatabaseNotFound(String)

The database name given was not found.

§

ViewNotFound

The view was not found.

§

CollectionNotFound

The collection was not found.

§

ApiNotFound(ApiName)

The api invoked was not found.

§

DatabaseNameAlreadyTaken(String)

The database name already exists.

§

Networking(Error)

An error occurred from networking.

§

CollectionAlreadyDefined

A Collection being added already exists. This can be caused by a collection name not being unique.

§

DocumentNotFound(CollectionName, Box<DocumentId, Global>)

An attempt to update a document that doesn’t exist.

§

DocumentIdTooLong

A value provided as a DocumentId exceeded DocumentId::MAX_LENGTH.

§

DocumentConflict(CollectionName, Box<Header, Global>)

When updating a document, if a situation is detected where the contents have changed on the server since the Revision provided, a Conflict error will be returned.

§

UniqueKeyViolation

Fields

§view: ViewName

The name of the view that the unique key violation occurred.

§conflicting_document: Box<Header, Global>

The document that caused the violation.

§existing_document: Box<Header, Global>

The document that already uses the same key.

When saving a document in a collection with unique views, a document emits a key that is already emitted by an existing ocument, this error is returned.

§

DocumentPush(CollectionName, NextValueError)

When pushing a document, an error occurred while generating the next unique id.

§

InvalidName(InvalidNameError)

An invalid name was specified during schema creation.

§

PermissionDenied(PermissionDenied)

Permission was denied.

§

Password(String)

An internal error handling passwords was encountered.

§

UserNotFound

The user specified was not found. This will not be returned in response to an invalid username being used during login. It will be returned in other APIs that operate upon users.

§

InvalidUnicode(String)

An error occurred converting from bytes to Utf-8.

§

InvalidCredentials

The credentials specified are not valid.

§

ReduceUnimplemented

Returned when the a view’s reduce() function is unimplemented.

§

NotANumber

A floating point operation yielded Not a Number.

§

Time(TimeError)

An error while operating with a time

§

Other

Fields

§origin: String

The origin of the error.

§error: String

The error message.

An error from another crate.

Implementations§

§

impl Error

pub fn other(origin: impl Display, error: impl Display) -> Error

Returns an instance of Self::Other with the given parameters.

pub fn is_unique_key_error<View, C>(&self, connection: &C) -> boolwhere View: View, C: HasSchema,

Returns true if this error is a Error::UniqueKeyViolation from View.

pub fn conflicting_document<Collection>(&self) -> Option<Header>where Collection: Collection,

Returns the header of the conflicting document if this error is a Error::DocumentConflict from Collection.

Trait Implementations§

§

impl Clone for Error

§

fn clone(&self) -> Error

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
§

impl Debug for Error

§

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

Formats the value using the given formatter. Read more
§

impl<'de> Deserialize<'de> for Error

§

fn deserialize<__D>( __deserializer: __D ) -> Result<Error, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
§

impl Display for Error

§

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

Formats the value using the given formatter. Read more
§

impl Error for Error

§

fn source(&self) -> Option<&(dyn Error + 'static)>

The lower-level source of this error, if any. Read more
1.0.0 · source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
source§

fn provide<'a>(&'a self, demand: &mut Demand<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more
§

impl From<ApiError<Error>> for Error

§

fn from(error: ApiError<Error>) -> Error

Converts to this type from the input type.
source§

impl<E> From<Error> for BackendError<E>

source§

fn from(err: Error) -> BackendError<E>

Converts to this type from the input type.
§

impl From<Error> for Error

§

fn from(source: Error) -> Error

Converts to this type from the input type.
§

impl From<Error> for Error

§

fn from(other: Error) -> Error

Converts to this type from the input type.
source§

impl From<Error> for Error

source§

fn from(other: Error) -> Error

Converts to this type from the input type.
§

impl From<Error> for Error

§

fn from(err: Error) -> Error

Converts to this type from the input type.
§

impl From<Error> for Error

§

fn from(err: Error) -> Error

Converts to this type from the input type.
§

impl From<Error> for Error

§

fn from(source: Error) -> Error

Converts to this type from the input type.
source§

impl From<Error> for Error

source§

fn from(err: Error) -> Error

Converts to this type from the input type.
source§

impl From<Error> for Error

source§

fn from(err: Error) -> Error

Converts to this type from the input type.
§

impl From<Error> for Error

§

fn from(err: Error) -> Error

Converts to this type from the input type.
§

impl From<Error> for Error

§

fn from(source: Error) -> Error

Converts to this type from the input type.
source§

impl From<Error> for Error

source§

fn from(source: Error) -> Error

Converts to this type from the input type.
source§

impl<E> From<Error> for HandlerError<E>where E: ApiError,

source§

fn from(err: Error) -> HandlerError<E>

Converts to this type from the input type.
§

impl From<FromUtf8Error> for Error

§

fn from(err: FromUtf8Error) -> Error

Converts to this type from the input type.
§

impl<T> From<InsertError<T>> for Error

§

fn from(err: InsertError<T>) -> Error

Converts to this type from the input type.
§

impl From<InvalidHexadecimal> for Error

§

fn from(err: InvalidHexadecimal) -> Error

Converts to this type from the input type.
§

impl From<InvalidNameError> for Error

§

fn from(source: InvalidNameError) -> Error

Converts to this type from the input type.
§

impl From<PermissionDenied> for Error

§

fn from(source: PermissionDenied) -> Error

Converts to this type from the input type.
§

impl From<TimeError> for Error

§

fn from(source: TimeError) -> Error

Converts to this type from the input type.
§

impl Serialize for Error

§

fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnwindSafe for Error

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32 ) -> TaggedParser<'a, Implicit, Self, E>

source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere 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<E> Provider for Ewhere E: Error + ?Sized,

source§

fn provide<'a>(&'a self, demand: &mut Demand<'a>)

🔬This is a nightly-only experimental API. (provide_any)
Data providers should implement this method to provide all values they are able to provide by using demand. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

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> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
§

impl<T> AnyError for Twhere T: Error + Send + Sync + 'static,

§

impl<T> ApiError for Twhere T: Display + Clone + Serialize + for<'de> Deserialize<'de> + Send + Sync + Debug,

§

impl<T> CacheError for Twhere T: Error + Send + Sync + 'static,

source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,