rusqlite

Enum Error

Source
#[non_exhaustive]
pub enum Error {
Show 21 variants SqliteFailure(Error, Option<String>), SqliteSingleThreadedMode, FromSqlConversionFailure(usize, Type, Box<dyn Error + Send + Sync + 'static>), IntegralValueOutOfRange(usize, i64), Utf8Error(Utf8Error), NulError(NulError), InvalidParameterName(String), InvalidPath(PathBuf), ExecuteReturnedResults, QueryReturnedNoRows, InvalidColumnIndex(usize), InvalidColumnName(String), InvalidColumnType(usize, String, Type), StatementChangedRows(usize), ToSqlConversionFailure(Box<dyn Error + Send + Sync + 'static>), InvalidQuery, UnwindingPanic, MultipleStatement, InvalidParameterCount(usize, usize), SqlInputError { error: Error, msg: String, sql: String, offset: c_int, }, InvalidDatabaseIndex(usize),
}
Expand description

Enum listing possible errors from rusqlite.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

SqliteFailure(Error, Option<String>)

An error from an underlying SQLite call.

§

SqliteSingleThreadedMode

Error reported when attempting to open a connection when SQLite was configured to allow single-threaded use only.

§

FromSqlConversionFailure(usize, Type, Box<dyn Error + Send + Sync + 'static>)

Error when the value of a particular column is requested, but it cannot be converted to the requested Rust type.

§

IntegralValueOutOfRange(usize, i64)

Error when SQLite gives us an integral value outside the range of the requested type (e.g., trying to get the value 1000 into a u8). The associated usize is the column index, and the associated i64 is the value returned by SQLite.

§

Utf8Error(Utf8Error)

Error converting a string to UTF-8.

§

NulError(NulError)

Error converting a string to a C-compatible string because it contained an embedded nul.

§

InvalidParameterName(String)

Error when using SQL named parameters and passing a parameter name not present in the SQL.

§

InvalidPath(PathBuf)

Error converting a file path to a string.

§

ExecuteReturnedResults

Error returned when an execute call returns rows.

§

QueryReturnedNoRows

Error when a query that was expected to return at least one row (e.g., for query_row) did not return any.

§

InvalidColumnIndex(usize)

Error when the value of a particular column is requested, but the index is out of range for the statement.

§

InvalidColumnName(String)

Error when the value of a named column is requested, but no column matches the name for the statement.

§

InvalidColumnType(usize, String, Type)

Error when the value of a particular column is requested, but the type of the result in that column cannot be converted to the requested Rust type.

§

StatementChangedRows(usize)

Error when a query that was expected to insert one row did not insert any or insert many.

§

ToSqlConversionFailure(Box<dyn Error + Send + Sync + 'static>)

Error available for the implementors of the ToSql trait.

§

InvalidQuery

Error when the SQL is not a SELECT, is not read-only.

§

UnwindingPanic

An unwinding panic occurs in a UDF (user-defined function).

§

MultipleStatement

Error when the SQL contains multiple statements.

§

InvalidParameterCount(usize, usize)

Error when the number of bound parameters does not match the number of parameters in the query. The first usize is how many parameters were given, the 2nd is how many were expected.

§

SqlInputError

Error referencing a specific token in the input SQL

Fields

§error: Error

error code

§msg: String

error message

§sql: String

SQL input

§offset: c_int

byte offset of the start of invalid token

§

InvalidDatabaseIndex(usize)

Error when the schema of a particular database is requested, but the index is out of range.

Implementations§

Source§

impl Error

Source

pub fn sqlite_error(&self) -> Option<&Error>

Returns the underlying SQLite error if this is Error::SqliteFailure.

Source

pub fn sqlite_error_code(&self) -> Option<ErrorCode>

Returns the underlying SQLite error code if this is Error::SqliteFailure.

Trait Implementations§

Source§

impl Debug for Error

Source§

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

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

impl Display for Error

Source§

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

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

impl Error for Error

Source§

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

Returns 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, request: &mut Request<'a>)

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

impl From<FromSqlError> for Error

The conversion isn’t precise, but it’s convenient to have it to allow use of get_raw(…).as_…()? in callbacks that take Error.

Source§

fn from(err: FromSqlError) -> Error

Converts to this type from the input type.
Source§

impl From<NulError> for Error

Source§

fn from(err: NulError) -> Error

Converts to this type from the input type.
Source§

impl From<Utf8Error> for Error

Source§

fn from(err: Utf8Error) -> Error

Converts to this type from the input type.
Source§

impl PartialEq for Error

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

§

impl Freeze for Error

§

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 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> 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> ToString for T
where 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 T
where U: Into<T>,

Source§

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