Skip to content

Commit

Permalink
Failing to send diagnostics should not fail the install (#1308)
Browse files Browse the repository at this point in the history
  • Loading branch information
cole-h authored Nov 21, 2024
1 parent 8a194a0 commit 82a64a3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
9 changes: 8 additions & 1 deletion src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,14 @@ impl DiagnosticData {
}

#[tracing::instrument(level = "debug", skip_all)]
pub async fn send(
pub async fn send(self, action: DiagnosticAction, status: DiagnosticStatus) {
if let Err(e) = self.send_impl(action, status).await {
tracing::debug!(?e, "Failed to send diagnostics");
}
}

#[tracing::instrument(level = "debug", skip_all)]
async fn send_impl(
self,
action: DiagnosticAction,
status: DiagnosticStatus,
Expand Down
14 changes: 7 additions & 7 deletions src/plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ impl InstallPlan {
crate::diagnostics::DiagnosticAction::Install,
crate::diagnostics::DiagnosticStatus::Cancelled,
)
.await?;
.await;
}

return Err(NixInstallerError::Cancelled);
Expand All @@ -210,7 +210,7 @@ impl InstallPlan {
crate::diagnostics::DiagnosticAction::Install,
crate::diagnostics::DiagnosticStatus::Failure,
)
.await?;
.await;
}

return Err(err);
Expand All @@ -232,7 +232,7 @@ impl InstallPlan {
crate::diagnostics::DiagnosticAction::Install,
crate::diagnostics::DiagnosticStatus::Failure,
)
.await?;
.await;
}

tracing::warn!("{err:?}")
Expand All @@ -245,7 +245,7 @@ impl InstallPlan {
crate::diagnostics::DiagnosticAction::Install,
crate::diagnostics::DiagnosticStatus::Success,
)
.await?;
.await;
}
}

Expand Down Expand Up @@ -360,7 +360,7 @@ impl InstallPlan {
crate::diagnostics::DiagnosticAction::Uninstall,
crate::diagnostics::DiagnosticStatus::Cancelled,
)
.await?;
.await;
}
return Err(NixInstallerError::Cancelled);
}
Expand All @@ -381,7 +381,7 @@ impl InstallPlan {
crate::diagnostics::DiagnosticAction::Uninstall,
crate::diagnostics::DiagnosticStatus::Success,
)
.await?;
.await;
}

Ok(())
Expand All @@ -396,7 +396,7 @@ impl InstallPlan {
crate::diagnostics::DiagnosticAction::Uninstall,
crate::diagnostics::DiagnosticStatus::Failure,
)
.await?;
.await;
}

Err(error)
Expand Down

0 comments on commit 82a64a3

Please sign in to comment.