1
0
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:
Matt Gibson
2025-10-02 15:56:38 -07:00
parent e559c1b046
commit f4ec8bd4a0
4 changed files with 17 additions and 2 deletions

1
akd/Cargo.lock generated
View File

@@ -67,6 +67,7 @@ dependencies = [
"akd",
"async-trait",
"ms_database",
"thiserror 2.0.17",
]
[[package]]

View File

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

View File

@@ -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),
}

View File

@@ -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}")]