From e2721e094ae51658c3182ec218be46fc7cab9388 Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Tue, 31 Jan 2023 13:03:57 +0800 Subject: [PATCH] Cont. added reexports for sqlx errors (#1434) * added reexports for sqlx errors (#1181) Co-authored-by: erhodes * Re-export SQLx error types * Apply suggestions from code review --------- Co-authored-by: e-rhodes <33500135+e-rhodes@users.noreply.github.com> Co-authored-by: erhodes Co-authored-by: Chris Tsang --- src/error.rs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/error.rs b/src/error.rs index 90385678..9656b125 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,5 +1,15 @@ -#[cfg(feature = "sqlx-dep")] -use sqlx::error::Error as SqlxError; +#[cfg(all(feature = "sea-orm-internal", feature = "sqlx-dep"))] +pub use sqlx::error::Error as SqlxError; + +#[cfg(all(feature = "sea-orm-internal", feature = "sqlx-mysql"))] +pub use sqlx::mysql::MySqlDatabaseError as SqlxMySqlError; + +#[cfg(all(feature = "sea-orm-internal", feature = "sqlx-postgres"))] +pub use sqlx::postgres::PgDatabaseError as SqlxPostgresError; + +#[cfg(all(feature = "sea-orm-internal", feature = "sqlx-sqlite"))] +pub use sqlx::sqlite::SqliteError as SqlxSqliteError; + use thiserror::Error; /// An error from unsuccessful database operations @@ -71,7 +81,7 @@ pub enum RuntimeErr { /// SQLx Error #[cfg(feature = "sqlx-dep")] #[error("{0}")] - SqlxError(SqlxError), + SqlxError(sqlx::error::Error), /// Error generated from within SeaORM #[error("{0}")] Internal(String),