feat: started db cli tool; switched to i64 ids
This commit is contained in:
parent
b343fbccea
commit
1f4b0c35c5
10 changed files with 86 additions and 29 deletions
|
|
@ -1,8 +1,8 @@
|
|||
use std::fmt::{self, Write};
|
||||
use std::fmt;
|
||||
|
||||
use axum::{http::StatusCode, response::IntoResponse};
|
||||
|
||||
use crate::db;
|
||||
use crate::{db, ErrorExt};
|
||||
|
||||
pub type AppResult<T> = Result<T, AppError>;
|
||||
|
||||
|
|
@ -40,24 +40,6 @@ impl std::error::Error for AppError {
|
|||
}
|
||||
}
|
||||
|
||||
pub trait ErrorExt: std::error::Error {
|
||||
/// Return the full chain of error messages
|
||||
fn stack(&self) -> String {
|
||||
let mut msg = format!("{}", self);
|
||||
let mut err = self.source();
|
||||
|
||||
while let Some(src) = err {
|
||||
write!(msg, " - {}", src).unwrap();
|
||||
|
||||
err = src.source();
|
||||
}
|
||||
|
||||
msg
|
||||
}
|
||||
}
|
||||
|
||||
impl<E: std::error::Error> ErrorExt for E {}
|
||||
|
||||
impl From<db::DbError> for AppError {
|
||||
fn from(value: db::DbError) -> Self {
|
||||
Self::Db(value)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue