Enum bonsaidb_core::Error
source · [−]pub enum Error {
Show 28 variants
SchemaMismatch {
database_name: String,
schema: SchemaName,
stored_schema: SchemaName,
},
SchemaAlreadyRegistered(SchemaName),
SchemaNotRegistered(SchemaName),
InvalidDatabaseName(String),
DatabaseNotFound(String),
DatabaseNameAlreadyTaken(String),
Database(String),
Serialization(String),
Server(String),
Transport(String),
Websocket(String),
Networking(Error),
Io(String),
Configuration(String),
Client(String),
CollectionNotFound,
CollectionAlreadyDefined,
DocumentNotFound(CollectionName, u64),
DocumentConflict(CollectionName, u64),
UniqueKeyViolation {
view: ViewName,
conflicting_document: Header,
existing_document: Header,
},
InvalidName(InvalidNameError),
PermissionDenied(PermissionDenied),
Password(String),
UserNotFound,
InvalidUnicode(String),
InvalidCredentials,
ReduceUnimplemented,
NotANumber,
}Expand description
an enumeration of errors that this crate can produce
Variants
SchemaMismatch
Fields
database_name: StringThe name of the database being accessed.
schema: SchemaNameThe schema provided for the database.
stored_schema: SchemaNameThe 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.
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.
DatabaseNameAlreadyTaken(String)
The database name already exists.
Database(String)
An error from interacting with local storage.
Serialization(String)
An error serializing data.
Server(String)
An error from interacting with a server.
Transport(String)
An error occurred from the QUIC transport layer.
Websocket(String)
An error occurred from the websocket transport layer.
Networking(Error)
An error occurred from networking.
Io(String)
An error occurred from IO.
Configuration(String)
An error occurred with the provided configuration options.
Client(String)
An error occurred inside of the client.
CollectionNotFound
An attempt to use a Collection with a Database that it wasn’t defined within.
CollectionAlreadyDefined
A Collection being added already exists. This can be caused by a collection name not being unique.
DocumentNotFound(CollectionName, u64)
An attempt to update a document that doesn’t exist.
DocumentConflict(CollectionName, u64)
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: ViewNameThe name of the view that the unique key violation occurred.
conflicting_document: HeaderThe document that caused the violation.
existing_document: HeaderThe 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.
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.
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Error
impl<'de> Deserialize<'de> for Error
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Error for Error
impl Error for Error
sourcefn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
sourcefn backtrace(&self) -> Option<&Backtrace>
fn backtrace(&self) -> Option<&Backtrace>
backtrace)Returns a stack backtrace, if available, of where this error occurred. Read more
1.0.0 · sourcefn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
sourceimpl From<FromUtf8Error> for Error
impl From<FromUtf8Error> for Error
sourcefn from(err: FromUtf8Error) -> Self
fn from(err: FromUtf8Error) -> Self
Performs the conversion.
sourceimpl<T> From<InsertError<T>> for Error
impl<T> From<InsertError<T>> for Error
sourcefn from(err: InsertError<T>) -> Self
fn from(err: InsertError<T>) -> Self
Performs the conversion.
sourceimpl From<InvalidNameError> for Error
impl From<InvalidNameError> for Error
sourcefn from(source: InvalidNameError) -> Self
fn from(source: InvalidNameError) -> Self
Performs the conversion.
sourceimpl From<PermissionDenied> for Error
impl From<PermissionDenied> for Error
sourcefn from(source: PermissionDenied) -> Self
fn from(source: PermissionDenied) -> Self
Performs the conversion.
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more