mirror of
https://github.com/bitwarden/server
synced 2026-01-28 23:36:12 +00:00
Improve ms_database errors
This commit is contained in:
1
akd/Cargo.lock
generated
1
akd/Cargo.lock
generated
@@ -67,6 +67,7 @@ dependencies = [
|
||||
"akd",
|
||||
"async-trait",
|
||||
"ms_database",
|
||||
"thiserror 2.0.17",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@@ -10,6 +10,7 @@ keywords.workspace = true
|
||||
akd = "0.11.0"
|
||||
async-trait = "0.1.89"
|
||||
ms_database = { path = "../ms_database" }
|
||||
thiserror = "2.0.17"
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
@@ -3,13 +3,27 @@ pub use migrate::{Migration, MigrationError, run_pending_migrations};
|
||||
|
||||
mod pool;
|
||||
pub use pool::ConnectionManager as MsSqlConnectionManager;
|
||||
pub use pool::{OnConnectError};
|
||||
|
||||
// re-expose tiberius types for convenience
|
||||
pub use tiberius::{error, Column, Row, ToSql};
|
||||
pub use tiberius::{error::Error as MsDbError, Column, Row, ToSql};
|
||||
|
||||
// re-expose bb8 types for convenience
|
||||
pub type Pool = bb8::Pool<MsSqlConnectionManager>;
|
||||
pub type PoolError = bb8::RunError<crate::pool::PoolError>;
|
||||
pub type PooledConnection<'a> = bb8::PooledConnection<'a, MsSqlConnectionManager>;
|
||||
|
||||
// re-expose macros for convenience
|
||||
pub use macros::{load_migrations, migration};
|
||||
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
pub enum MsDatabaseError {
|
||||
#[error("Pool error: {0}")]
|
||||
Pool(#[from] PoolError),
|
||||
#[error("On Connect error: {0}")]
|
||||
OnConnectError(#[from] OnConnectError),
|
||||
#[error("Migration error: {0}")]
|
||||
Migration(#[from] MigrationError),
|
||||
#[error("Database error: {0}")]
|
||||
Db(#[from] MsDbError),
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ use tokio_util::compat::TokioAsyncWriteCompatExt;
|
||||
use bb8::ManageConnection;
|
||||
use tiberius::{Client, Config};
|
||||
|
||||
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
pub enum OnConnectError {
|
||||
#[error("Config error: {0}")]
|
||||
|
||||
Reference in New Issue
Block a user