feat: started db cli tool; switched to i64 ids

This commit is contained in:
Jef Roosens 2025-02-23 17:06:26 +01:00
parent b343fbccea
commit 1f4b0c35c5
No known key found for this signature in database
GPG key ID: 21FD3D77D56BAF49
10 changed files with 86 additions and 29 deletions

View file

@ -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)