diff --git a/backend/Cargo.lock b/backend/Cargo.lock index f7452ef..17c63e4 100644 --- a/backend/Cargo.lock +++ b/backend/Cargo.lock @@ -80,11 +80,11 @@ dependencies = [ "chrono", "http-body-util", "jsonwebtoken", - "rand", + "rand 0.9.4", "serde", "serde_json", "sqlx", - "thiserror 1.0.69", + "thiserror 2.0.18", "tokio", "tower 0.4.13", "tower-http", @@ -1125,7 +1125,7 @@ dependencies = [ "num-integer", "num-iter", "num-traits", - "rand", + "rand 0.8.6", "smallvec", "zeroize", ] @@ -1356,8 +1356,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ca0ecfa931c29007047d1bc58e623ab12e5590e8c7cc53200d5202b69266d8a" dependencies = [ "libc", - "rand_chacha", - "rand_core", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44c5af06bb1b7d3216d91932aed5265164bf384dc89cd6ba05cf59a35f5f76ea" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.5", ] [[package]] @@ -1367,7 +1377,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.5", ] [[package]] @@ -1379,6 +1399,15 @@ dependencies = [ "getrandom 0.2.17", ] +[[package]] +name = "rand_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" +dependencies = [ + "getrandom 0.3.4", +] + [[package]] name = "redox_syscall" version = "0.5.18" @@ -1441,7 +1470,7 @@ dependencies = [ "num-traits", "pkcs1", "pkcs8", - "rand_core", + "rand_core 0.6.4", "signature", "spki", "subtle", @@ -1605,7 +1634,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" dependencies = [ "digest", - "rand_core", + "rand_core 0.6.4", ] [[package]] @@ -1790,7 +1819,7 @@ dependencies = [ "memchr", "once_cell", "percent-encoding", - "rand", + "rand 0.8.6", "rsa", "serde", "sha1", @@ -1829,7 +1858,7 @@ dependencies = [ "md-5", "memchr", "once_cell", - "rand", + "rand 0.8.6", "serde", "serde_json", "sha2", diff --git a/backend/Cargo.toml b/backend/Cargo.toml index 5dba4df..a968b62 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -13,8 +13,8 @@ jsonwebtoken = "9" bcrypt = "0.15" tower-http = { version = "0.5", features = ["fs", "cors"] } chrono = { version = "0.4", features = ["serde"] } -rand = "0.8" -thiserror = "1" +rand = "0.9" +thiserror = "2" tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } diff --git a/backend/src/error.rs b/backend/src/error.rs index c546d53..a27d298 100644 --- a/backend/src/error.rs +++ b/backend/src/error.rs @@ -19,7 +19,10 @@ pub enum AppError { impl IntoResponse for AppError { fn into_response(self) -> Response { let (status, msg) = match &self { - AppError::Db(_) => (StatusCode::INTERNAL_SERVER_ERROR, "internal error".into()), + AppError::Db(e) => { + tracing::error!(error = %e, "database error"); + (StatusCode::INTERNAL_SERVER_ERROR, "internal error".into()) + } AppError::NotFound => (StatusCode::NOT_FOUND, "not found".into()), AppError::Conflict(m) => (StatusCode::CONFLICT, m.clone()), AppError::Unauthorized => (StatusCode::UNAUTHORIZED, "unauthorized".into()), diff --git a/backend/src/main.rs b/backend/src/main.rs index 0033d1e..2209dfd 100644 --- a/backend/src/main.rs +++ b/backend/src/main.rs @@ -15,7 +15,8 @@ async fn main() { let pool = db::init().await.expect("db init failed"); let app = routes::build(pool); - let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap(); + let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await + .expect("failed to bind :3000"); tracing::info!("listening on :3000"); - axum::serve(listener, app).await.unwrap(); + axum::serve(listener, app).await.expect("server error"); }