mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
12 lines
384 B
Rust
12 lines
384 B
Rust
use backend_service::errors::{ErrorCode, ServerError};
|
|
use sqlx::{Error, Postgres, Transaction};
|
|
|
|
pub type DBTransaction<'a> = Transaction<'a, Postgres>;
|
|
|
|
pub fn map_sqlx_error(error: sqlx::Error) -> ServerError {
|
|
match error {
|
|
Error::RowNotFound => ServerError::new("".to_string(), ErrorCode::RecordNotFound),
|
|
_ => ServerError::internal().context(error),
|
|
}
|
|
}
|