mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-23 00:39:20 +08:00
Document new Error enum.
This commit is contained in:
parent
7920dbc5ff
commit
2e082d7f94
@ -1,5 +1,11 @@
|
|||||||
# Version UPCOMING (TBD)
|
# Version UPCOMING (TBD)
|
||||||
|
|
||||||
|
* BREAKING CHANGE: `SqliteError` is now an enum instead of a struct. Previously, we were (ab)using
|
||||||
|
the error code and message to send back both underlying SQLite errors and errors that occurred
|
||||||
|
at the Rust level. Now those have been separated out; SQLite errors are returned as
|
||||||
|
`SqliteFailure` cases (which still include the error code but also include a Rust-friendlier
|
||||||
|
enum as well), and rusqlite-level errors are captured in other cases. Because of this change,
|
||||||
|
`SqliteError` no longer implements `PartialEq`.
|
||||||
* BREAKING CHANGE: `SqliteTransactionDeferred`, `SqliteTransactionImmediate`, and
|
* BREAKING CHANGE: `SqliteTransactionDeferred`, `SqliteTransactionImmediate`, and
|
||||||
`SqliteTransactionExclusive` are no longer exported. Instead, use
|
`SqliteTransactionExclusive` are no longer exported. Instead, use
|
||||||
`TransactionBehavior::Deferred`, `TransactionBehavior::Immediate`, and
|
`TransactionBehavior::Deferred`, `TransactionBehavior::Immediate`, and
|
||||||
|
31
src/error.rs
31
src/error.rs
@ -8,22 +8,53 @@ use {ffi, errmsg_to_string};
|
|||||||
/// Old name for `Error`. `SqliteError` is deprecated.
|
/// Old name for `Error`. `SqliteError` is deprecated.
|
||||||
pub type SqliteError = Error;
|
pub type SqliteError = Error;
|
||||||
|
|
||||||
|
/// Enum listing possible errors from rusqlite.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
|
/// An error from an underlying SQLite call.
|
||||||
SqliteFailure(ffi::Error, Option<String>),
|
SqliteFailure(ffi::Error, Option<String>),
|
||||||
|
|
||||||
|
/// An error case available for implementors of the `FromSql` trait.
|
||||||
FromSqlConversionFailure(Box<error::Error + Send + Sync>),
|
FromSqlConversionFailure(Box<error::Error + Send + Sync>),
|
||||||
|
|
||||||
|
/// Error converting a string to UTF-8.
|
||||||
Utf8Error(str::Utf8Error),
|
Utf8Error(str::Utf8Error),
|
||||||
|
|
||||||
|
/// Error converting a string to a C-compatible string because it contained an embedded nul.
|
||||||
NulError(::std::ffi::NulError),
|
NulError(::std::ffi::NulError),
|
||||||
|
|
||||||
|
/// Error when using SQL named parameters and passing a parameter name not present in the SQL.
|
||||||
InvalidParameterName(String),
|
InvalidParameterName(String),
|
||||||
|
|
||||||
|
/// Error converting a file path to a string.
|
||||||
InvalidPath(PathBuf),
|
InvalidPath(PathBuf),
|
||||||
|
|
||||||
|
/// Error returned when an `execute` call returns rowss.
|
||||||
ExecuteReturnedResults,
|
ExecuteReturnedResults,
|
||||||
|
|
||||||
|
/// Error when a query that was expected to return at least one row (e.g., for `query_row`)
|
||||||
|
/// did not return any.
|
||||||
QueryReturnedNoRows,
|
QueryReturnedNoRows,
|
||||||
|
|
||||||
|
/// Error when trying to access a `Row` after stepping past it. See the discussion on
|
||||||
|
/// the `Rows` type for more details.
|
||||||
GetFromStaleRow,
|
GetFromStaleRow,
|
||||||
|
|
||||||
|
/// Error when the value of a particular column is requested, but the index is out of range
|
||||||
|
/// for the statement.
|
||||||
InvalidColumnIndex(c_int),
|
InvalidColumnIndex(c_int),
|
||||||
|
|
||||||
|
/// 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.
|
||||||
InvalidColumnType,
|
InvalidColumnType,
|
||||||
|
|
||||||
|
/// Error returned by `functions::Context::get` when the function argument cannot be converted
|
||||||
|
/// to the requested type.
|
||||||
#[cfg(feature = "functions")]
|
#[cfg(feature = "functions")]
|
||||||
InvalidFunctionParameterType,
|
InvalidFunctionParameterType,
|
||||||
|
|
||||||
|
/// An error case available for implementors of custom user functions (e.g.,
|
||||||
|
/// `create_scalar_function`).
|
||||||
#[cfg(feature = "functions")]
|
#[cfg(feature = "functions")]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
UserFunctionError(Box<error::Error + Send + Sync>),
|
UserFunctionError(Box<error::Error + Send + Sync>),
|
||||||
|
Loading…
Reference in New Issue
Block a user