mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2025-05-03 13:42:49 +03:00
feat: implement accountnotfound and captcha notfound err vals for sqlx postgres
This commit is contained in:
parent
3edb2252af
commit
ddb6d336f7
2 changed files with 17 additions and 1 deletions
db/db-sqlx-postgres/src
|
@ -21,6 +21,15 @@ use std::borrow::Cow;
|
|||
use db_core::dev::*;
|
||||
use sqlx::Error;
|
||||
|
||||
/// map custom row not found error to DB error
|
||||
pub fn map_row_not_found_err(e: Error, row_not_found: DBError) -> DBError {
|
||||
if let Error::RowNotFound = e {
|
||||
row_not_found
|
||||
} else {
|
||||
map_register_err(e)
|
||||
}
|
||||
}
|
||||
|
||||
/// map postgres errors to [DBError](DBError) types
|
||||
pub fn map_register_err(e: Error) -> DBError {
|
||||
if let Error::Database(err) = e {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue