pub enum DrizzleError {
Show 19 variants
ExecutionError(CompactString),
PrepareError(CompactString),
NotFound,
TransactionError(CompactString),
Mapping(CompactString),
Statement(CompactString),
Query(CompactString),
QueryFailed {
ctx: Box<QueryContext>,
source: Box<DrizzleError>,
},
ParameterError(CompactString),
TryFromInt(TryFromIntError),
ParseInt(ParseIntError),
ParseFloat(ParseFloatError),
ParseBool(ParseBoolError),
ConversionError(CompactString),
Schema(CompactString),
UnsafeMigrationRepair {
tag: CompactString,
reason: CompactString,
},
UnsupportedMigrationExecution {
adapter: CompactString,
requirement: CompactString,
},
Other(CompactString),
Infallible(Infallible),
}Expand description
Every error a Drizzle query, conversion or migration can return.
Driver errors are wrapped in a variant for that driver when its feature
is enabled. DrizzleError::QueryFailed adds the failing SQL and
parameters to another error.
Variants§
ExecutionError(CompactString)
The statement failed to execute.
PrepareError(CompactString)
The statement failed to prepare.
NotFound
A query that returns exactly one row, such as an aggregate with no GROUP BY, returned none.
TransactionError(CompactString)
A transaction could not begin, commit or roll back.
Mapping(CompactString)
A row could not be mapped to the target type.
Statement(CompactString)
The statement is invalid.
Query(CompactString)
The query is invalid.
QueryFailed
Another error, with the SQL and parameters of the query that caused
it. The message shows the parameter count, not the values; see
QueryContext.
Fields
ctx: Box<QueryContext>Captured SQL and parameter context.
source: Box<DrizzleError>Original error.
ParameterError(CompactString)
Parameters could not be bound: missing, duplicate or unexpected bindings, or a value that could not be converted.
TryFromInt(TryFromIntError)
An integer did not fit the target type.
ParseInt(ParseIntError)
Text could not be parsed as an integer.
ParseFloat(ParseFloatError)
Text could not be parsed as a float.
ParseBool(ParseBoolError)
Text could not be parsed as a boolean.
ConversionError(CompactString)
A value could not be converted to the requested type.
Schema(CompactString)
The schema is invalid (for example a cycle in table dependencies).
UnsafeMigrationRepair
A dirty migration cannot be repaired without violating its execution safety contract.
Fields
tag: CompactStringMigration tag recorded in the tracking table.
reason: CompactStringSafety requirement that prevents automatic repair.
UnsupportedMigrationExecution
The selected adapter cannot provide a migration’s required execution semantics.
Fields
adapter: CompactStringRuntime adapter that cannot provide the required semantics.
requirement: CompactStringMigration execution capability the adapter does not provide.
Other(CompactString)
Any other error.
Infallible(Infallible)
Never constructed; lets ? work on infallible conversions.
Implementations§
Source§impl DrizzleError
impl DrizzleError
Sourcepub fn kind(&self) -> ErrorKind
pub fn kind(&self) -> ErrorKind
What kind of failure this is, the same on every driver.
It looks through QueryFailed to the driver’s
error.
§Examples
use drizzle_core::error::{DrizzleError, ErrorKind};
let error = DrizzleError::Other("UNIQUE constraint failed: users.email".into());
assert_eq!(error.kind(), ErrorKind::UniqueViolation);
assert!(!error.is_retryable());Sourcepub fn constraint(&self) -> Option<&str>
pub fn constraint(&self) -> Option<&str>
The name of the constraint the failure names, when the database
reports one: the constraint on PostgreSQL and MySQL, and a CHECK on
SQLite, which SQLite names by its expression when it has no name.
SQLite names only the columns of a UNIQUE failure, so that is None.
It looks through QueryFailed.
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Whether running the statement or transaction again can succeed; see
ErrorKind::is_retryable.
Sourcepub fn query(&self) -> Option<&QueryContext>
pub fn query(&self) -> Option<&QueryContext>
The SQL and parameters of the query that failed, when drizzle ran it.
Trait Implementations§
Source§impl Debug for DrizzleError
impl Debug for DrizzleError
Source§impl Display for DrizzleError
impl Display for DrizzleError
Source§impl Error for DrizzleError
impl Error for DrizzleError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<!> for DrizzleError
impl From<!> for DrizzleError
Source§fn from(source: Infallible) -> Self
fn from(source: Infallible) -> Self
Source§impl From<ParseBoolError> for DrizzleError
impl From<ParseBoolError> for DrizzleError
Source§fn from(source: ParseBoolError) -> Self
fn from(source: ParseBoolError) -> Self
Source§impl From<ParseFloatError> for DrizzleError
impl From<ParseFloatError> for DrizzleError
Source§fn from(source: ParseFloatError) -> Self
fn from(source: ParseFloatError) -> Self
Source§impl From<ParseIntError> for DrizzleError
impl From<ParseIntError> for DrizzleError
Source§fn from(source: ParseIntError) -> Self
fn from(source: ParseIntError) -> Self
Source§impl From<TryFromIntError> for DrizzleError
impl From<TryFromIntError> for DrizzleError
Source§fn from(source: TryFromIntError) -> Self
fn from(source: TryFromIntError) -> Self
Auto Trait Implementations§
impl Freeze for DrizzleError
impl RefUnwindSafe for DrizzleError
impl Send for DrizzleError
impl Sync for DrizzleError
impl Unpin for DrizzleError
impl UnsafeUnpin for DrizzleError
impl UnwindSafe for DrizzleError
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<Joined, From> JoinKey<From, JoinReverse> for Joined
impl<Joined, From> JoinKey<From, JoinReverse> for Joined
impl<List> ListIncludes<Nil, ()> for List
impl<Mk> MarkerAggValidFor<()> for Mk
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more