From d9234ecd1122684040d15939f4e02c26c93567e7 Mon Sep 17 00:00:00 2001 From: Gabriel Kaszewski Date: Fri, 12 Jun 2026 01:18:54 +0200 Subject: [PATCH] fix(presentation): log errors in diary export stream --- crates/presentation/Cargo.toml | 1 + crates/presentation/src/handlers/diary.rs | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/crates/presentation/Cargo.toml b/crates/presentation/Cargo.toml index e5007f8..a982de0 100644 --- a/crates/presentation/Cargo.toml +++ b/crates/presentation/Cargo.toml @@ -42,6 +42,7 @@ dotenvy = { workspace = true } uuid = { workspace = true } chrono = { workspace = true } async-trait = { workspace = true } +futures = { workspace = true } api-types = { workspace = true } domain = { workspace = true, features = ["test-helpers"] } diff --git a/crates/presentation/src/handlers/diary.rs b/crates/presentation/src/handlers/diary.rs index fd88571..f29830d 100644 --- a/crates/presentation/src/handlers/diary.rs +++ b/crates/presentation/src/handlers/diary.rs @@ -5,6 +5,7 @@ use axum::{ http::StatusCode, response::{IntoResponse, Redirect}, }; +use futures::StreamExt; use uuid::Uuid; use application::diary::{ @@ -153,6 +154,12 @@ pub async fn export_diary( &state.app_ctx.services.diary_exporter, query, ); + let stream = stream.map(|r| { + if let Err(ref e) = r { + tracing::error!("diary export stream error: {e}"); + } + r + }); ( StatusCode::OK, [ @@ -313,6 +320,12 @@ pub async fn get_export_html( &state.app_ctx.services.diary_exporter, query, ); + let stream = stream.map(|r| { + if let Err(ref e) = r { + tracing::error!("diary export stream error: {e}"); + } + r + }); ( StatusCode::OK, [