sqlx_sqlite_conn_mgr/
error.rs

1//! Error types for sqlx-sqlite-conn-mgr
2
3use thiserror::Error;
4
5/// Errors that may occur when working with sqlx-sqlite-conn-mgr
6#[derive(Error, Debug)]
7pub enum Error {
8   /// IO error when accessing database files. Standard library IO errors
9   /// are converted to this variant.
10   #[error("IO error: {0}")]
11   Io(#[from] std::io::Error),
12
13   /// Error from the sqlx library. Standard sqlx errors are converted to this variant
14   #[error("Sqlx error: {0}")]
15   Sqlx(#[from] sqlx::Error),
16
17   /// Migration error from the sqlx migrate framework
18   #[error("Migration error: {0}")]
19   Migration(#[from] sqlx::migrate::MigrateError),
20
21   /// Database has been closed and cannot be used
22   #[error("Database has been closed")]
23   DatabaseClosed,
24
25   /// Cannot attach a database as read-write to a read-only connection
26   #[error("Cannot attach database as read-write to a read-only connection")]
27   CannotAttachReadWriteToReader,
28
29   /// Invalid schema name provided for attached database
30   #[error(
31      "Invalid schema name '{0}': must contain only alphanumeric characters and underscores, and cannot start with a digit"
32   )]
33   InvalidSchemaName(String),
34
35   /// Attempted to attach the same database multiple times
36   #[error(
37      "Database '{0}' appears multiple times in attached database list (would cause deadlock)"
38   )]
39   DuplicateAttachedDatabase(String),
40}