Better error reporting for removing Python versions from the Windows registry (#14722)

See
https://github.com/astral-sh/uv/actions/runs/16370666070/job/46258004849

We didn't actual use a format string, showing the template instead. We
don't show the causes in the error report, so we format it into one
error.
This commit is contained in:
konsti 2025-07-18 15:26:47 +02:00 committed by GitHub
parent a186fda2d2
commit 574aa1ef11
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -3,6 +3,7 @@
use crate::managed::ManagedPythonInstallation;
use crate::platform::Arch;
use crate::{COMPANY_DISPLAY_NAME, COMPANY_KEY, PythonInstallationKey, PythonVersion};
use anyhow::anyhow;
use std::cmp::Ordering;
use std::collections::HashSet;
use std::path::PathBuf;
@ -238,8 +239,7 @@ pub fn remove_registry_entry<'a>(
} else {
errors.push((
installation.key().clone(),
anyhow::Error::new(err)
.context("Failed to clear registry entries under HKCU:\\{python_entry}"),
anyhow!("Failed to clear registry entries under HKCU:\\{python_entry}: {err}"),
));
}
}