1
0
Fork 0
mirror of https://github.com/zhaofengli/attic.git synced 2024-12-14 11:57:30 +00:00

Merge pull request #187 from cole-h/stream-error-better

Display anyhow error chains better
This commit is contained in:
Zhaofeng Li 2024-10-16 16:09:56 -06:00 committed by GitHub
commit 2b05b7d986
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 5 deletions

View file

@ -218,7 +218,7 @@ async fn get_nar(
Download::Url(url) => Ok(Redirect::temporary(&url).into_response()),
Download::AsyncRead(stream) => {
let stream = ReaderStream::new(stream).map_err(|e| {
tracing::error!("Stream error: {e}");
tracing::error!(%e, "Stream error");
e
});
let body = Body::from_stream(stream);
@ -255,7 +255,7 @@ 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).map_err(|e| {
tracing::error!("Stream error: {e}");
tracing::error!(%e, "Stream error");
e
});
let body = Body::from_stream(merged);

View file

@ -57,10 +57,10 @@ pub enum ErrorKind {
/// The requested NAR has missing chunks and needs to be repaired.
IncompleteNar,
/// Database error: {0}
/// Database error: {0:#}
DatabaseError(AnyError),
/// Storage error: {0}
/// Storage error: {0:#}
StorageError(AnyError),
/// Manifest serialization error: {0}
@ -69,7 +69,7 @@ pub enum ErrorKind {
/// Access error: {0}
AccessError(super::access::Error),
/// General request error: {0}
/// General request error: {0:#}
RequestError(AnyError),
/// Error from the common components.