diff --git a/server/src/api/binary_cache.rs b/server/src/api/binary_cache.rs index 90431b1..0c62ae8 100644 --- a/server/src/api/binary_cache.rs +++ b/server/src/api/binary_cache.rs @@ -9,6 +9,7 @@ use std::io::{Error as IoError, ErrorKind as IoErrorKind}; use std::path::PathBuf; use std::sync::Arc; +use axum::body::HttpBody as _; use axum::{ body::StreamBody, extract::{Extension, Path}, @@ -217,7 +218,11 @@ async fn get_nar( Download::Url(url) => Ok(Redirect::temporary(&url).into_response()), Download::AsyncRead(stream) => { let stream = ReaderStream::new(stream); - let body = StreamBody::new(stream); + let body = StreamBody::new(stream).map_err(|e| { + tracing::error!("Stream error: {e}"); + e + }); + Ok(body.into_response()) } } @@ -250,7 +255,11 @@ async fn get_nar( // TODO: Make num_prefetch configurable // The ideal size depends on the average chunk size let merged = merge_chunks(chunks, streamer, storage, 2); - let body = StreamBody::new(merged); + let body = StreamBody::new(merged).map_err(|e| { + tracing::error!("Stream error: {e}"); + e + }); + Ok(body.into_response()) } }