From bf04f8a1ff2abe2d1e682ed032d2e37004df4e39 Mon Sep 17 00:00:00 2001 From: rob thijssen Date: Sun, 3 May 2026 19:31:10 +0300 Subject: [PATCH] fix(api): log internal handler errors Tower-http's TraceLayer logged the failure status code but not the underlying error, leaving 500s opaque without curling the response body. Log the error from the internal() helper so server logs carry the actual cause (permission denied, query error, etc.). Co-Authored-By: Claude Opus 4.7 (1M context) --- crates/moments-api/src/main.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/moments-api/src/main.rs b/crates/moments-api/src/main.rs index 6f27ec8..6d7d4eb 100644 --- a/crates/moments-api/src/main.rs +++ b/crates/moments-api/src/main.rs @@ -145,9 +145,11 @@ impl ApiError { } fn internal(e: E) -> ApiError { + let message = e.to_string(); + tracing::error!(error = %message, "internal handler error"); ApiError { status: StatusCode::INTERNAL_SERVER_ERROR, - message: e.to_string(), + message, } }