diff --git a/modules/exploit-intelligence/src/runner/analysis.rs b/modules/exploit-intelligence/src/runner/analysis.rs index 9778eee89..85e8e75ae 100644 --- a/modules/exploit-intelligence/src/runner/analysis.rs +++ b/modules/exploit-intelligence/src/runner/analysis.rs @@ -44,10 +44,7 @@ async fn upload_sbom( let response = classify_response_error(label, request.send().await) .await - .map_err(|e| { - tracing::warn!(error = %e, label, "EI upload failed"); - AnalysisError::from(e) - })?; + .map_err(AnalysisError::from)?; Ok(response) } diff --git a/modules/exploit-intelligence/src/runner/mod.rs b/modules/exploit-intelligence/src/runner/mod.rs index b706c56cc..d57d00aff 100644 --- a/modules/exploit-intelligence/src/runner/mod.rs +++ b/modules/exploit-intelligence/src/runner/mod.rs @@ -19,19 +19,6 @@ pub(crate) enum EiRequestError { Permanent(anyhow::Error), } -impl EiRequestError { - /// User-facing error message suitable for storing in the database. - /// Transient errors get a generic message; rejected errors surface - /// the EI response so users can fix their input. - pub(crate) fn user_message(&self) -> String { - match self { - Self::Transient(_) => "analysis service temporarily unavailable".to_string(), - Self::Rejected(msg) => msg.clone(), - Self::Permanent(_) => "internal analysis error".to_string(), - } - } -} - /// Error from a single analysis tick, classified for retry decisions. #[derive(Debug, thiserror::Error)] pub(crate) enum AnalysisError { @@ -74,12 +61,10 @@ impl From for AnalysisError { impl From for AnalysisError { fn from(e: EiRequestError) -> Self { - let msg = e.user_message(); match e { - EiRequestError::Transient(_) => Self::Retryable(anyhow::anyhow!("{msg}")), - EiRequestError::Rejected(_) | EiRequestError::Permanent(_) => { - Self::Permanent(anyhow::anyhow!("{msg}")) - } + EiRequestError::Transient(detail) => Self::Retryable(anyhow::anyhow!("{detail}")), + EiRequestError::Rejected(detail) => Self::Permanent(anyhow::anyhow!("{detail}")), + EiRequestError::Permanent(err) => Self::Permanent(err), } } }