Skip to content

Commit be0e9b3

Browse files
committed
ed: revert error types
1 parent a6cda33 commit be0e9b3

File tree

2 files changed

+4
-21
lines changed

2 files changed

+4
-21
lines changed

editoast/editoast_models/src/db_connection_pool.rs

+2-14
Original file line numberDiff line numberDiff line change
@@ -131,20 +131,8 @@ impl Default for DbConnectionPoolV2 {
131131
pub struct DatabasePoolBuildError(#[from] diesel_async::pooled_connection::deadpool::BuildError);
132132

133133
#[derive(Debug, thiserror::Error)]
134-
pub enum DatabasePoolError {
135-
#[error("an error occurred while getting a connection from the database pool: '{0}'")]
136-
Pool(#[from] diesel_async::pooled_connection::deadpool::PoolError),
137-
#[error("an error occured while querying the database: {0}")]
138-
DieselError(#[from] diesel::result::Error),
139-
}
140-
141-
#[derive(Debug, thiserror::Error)]
142-
pub enum DatabaseTransactionError {
143-
#[error("an error occurred while getting a connection from the database pool: '{0}'")]
144-
Pool(#[from] DatabasePoolError),
145-
#[error("an error occured while querying the database: {0}")]
146-
DieselError(#[from] diesel::result::Error),
147-
}
134+
#[error("an error occurred while getting a connection from the database pool: '{0}'")]
135+
pub struct DatabasePoolError(#[from] diesel_async::pooled_connection::deadpool::PoolError);
148136

149137
impl DbConnectionPoolV2 {
150138
/// Get inner pool for retro compatibility

editoast/editoast_models/src/lib.rs

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use db_connection_pool::DatabasePoolError;
21
use diesel_async::pooled_connection::deadpool::Pool;
32
use diesel_async::AsyncPgConnection;
43

@@ -15,9 +14,5 @@ pub type DbConnectionPool = Pool<DieselConnection>;
1514
///
1615
/// Useful for functions which only points of failure are the DB calls.
1716
#[derive(Debug, thiserror::Error)]
18-
pub enum DatabaseError {
19-
#[error("an error occured while querying the database: {0}")]
20-
DieselError(#[from] diesel::result::Error),
21-
#[error("an error occured while retrieving a connection from the pool: {0}")]
22-
DatabasePoolError(#[from] DatabasePoolError),
23-
}
17+
#[error("an error occured while querying the database: {0}")]
18+
pub struct DatabaseError(#[from] diesel::result::Error);

0 commit comments

Comments
 (0)