This commit is contained in:
senset
2022-06-29 10:13:09 +08:00
parent af9c05d805
commit 0dcf74819d
3 changed files with 14 additions and 59 deletions

View File

@@ -4,7 +4,7 @@ use sea_orm::{
ActiveModelTrait, ColumnTrait, Database, DatabaseConnection, DatabaseTransaction, DbErr,
EntityTrait, PaginatorTrait, QueryFilter, Set, TransactionTrait,
};
use wd_log::{log_error_ln, log_info_ln, log_warn_ln};
use wd_log::{log_error_ln, log_info_ln, log_panic, log_warn_ln};
const PAGE_SIZE: usize = 25;
@@ -185,6 +185,9 @@ impl Controller {
}
pub fn err_handler(&self, error: DbErr) {
log_error_ln!("{}", error);
match error {
DbErr::Conn(err) => log_panic!("{}", err),
error => log_error_ln!("{}", error),
}
}
}

View File

@@ -29,7 +29,7 @@ async fn main() {
};
if let Err(err) = bot.init().await {
log_panic!("{}", err);
bot.controller.err_handler(err);
}
bot.run().await;