Skip to content

Commit

Permalink
don't provide both a source and embed it into the Display impl
Browse files Browse the repository at this point in the history
  • Loading branch information
relaxolotl committed Aug 6, 2021
1 parent 0556416 commit a76e332
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
16 changes: 13 additions & 3 deletions crates/symbolicator/src/services/download/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,10 @@ pub enum DownloadError {
Write(#[source] std::io::Error),
#[error("download was cancelled")]
Canceled,
#[error("failed to fetch data from GCS: {0}")]
#[error("failed to fetch data from GCS")]
Gcs(#[from] gcs::GcsError),
#[error("failed to fetch data from Sentry: {0}")]
#[error("failed to fetch data from Sentry")]
Sentry(#[from] sentry::SentryError),
#[allow(unused)]
#[error("failed to fetch data from S3")]
S3(#[from] s3::S3Error),
/// Typically means the initial HEAD request received a non-200, non-400 response.
Expand All @@ -59,6 +58,17 @@ pub enum DownloadError {
Rejected(StatusCode),
}

impl DownloadError {
pub fn for_cache(&self) -> String {
match self {
DownloadError::Gcs(inner) => format!("{}: {}", self, inner),
DownloadError::Sentry(inner) => format!("{}: {}", self, inner),
DownloadError::S3(inner) => format!("{}: {}", self, inner),
_ => format!("{}", self),
}
}
}

/// Completion status of a successful download request.
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
pub enum DownloadStatus {
Expand Down
2 changes: 1 addition & 1 deletion crates/symbolicator/src/services/objects/data_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ impl CacheItemRequest for FetchFileDataRequest {

Err(e) => {
log::error!("Error while downloading file: {}", LogError(&e));
return Ok(CacheStatus::Malformed(e.to_string()));
return Ok(CacheStatus::Malformed(e.for_cache()));
}

Ok(DownloadStatus::Completed) => {
Expand Down

0 comments on commit a76e332

Please sign in to comment.