Improve error messages by showing more context#1433
Improve error messages by showing more context#1433fingolfin merged 3 commits intoJuliaLang:mainfrom
Conversation
|
Tests pass. I manually went over the PR to verify the AI did not produce arbitrary garbage, it all seems sensible. Though of course I can not guarantee it is all perfect (I couldn't if I had written it myself either...). Though if this causes regressions, I offer to take care of them (in the worst case by reverting select messages to their prior state). I also verified that it improves the error message in cases I care about. So I hope this can be merged? |
|
(In other words: would be great if someone could approve this, then I can merge it... ;-) ) |
|
Looks good to me, but Claude found further fixes and a correction to lump into this diff --git a/src/command_override.rs b/src/command_override.rs
index e150c09..02c76c5 100644
--- a/src/command_override.rs
+++ b/src/command_override.rs
@@ -160,7 +160,7 @@ pub fn run_command_override_unset(
save_config_db(&mut config_file).with_context(|| {
format!(
- "Failed to save configuration file from `override add` command at `{}`.",
+ "Failed to save configuration file from `override unset` command at `{}`.",
paths.juliaupconfig.display()
)
})?;
diff --git a/src/operations.rs b/src/operations.rs
index 9c8a7b5..3191cb6 100644
--- a/src/operations.rs
+++ b/src/operations.rs
@@ -1237,9 +1237,13 @@ pub fn garbage_collect_versions(
}
fn _remove_symlink(symlink_path: &Path) -> Result<Option<PathBuf>> {
- std::fs::create_dir_all(symlink_path.parent().unwrap()).with_context(|| {
+ let parent = symlink_path
+ .parent()
+ .ok_or_else(|| anyhow!("Symlink path `{}` has no parent directory.", symlink_path.display()))?;
+ std::fs::create_dir_all(parent).with_context(|| {
format!(
- "Failed to create parent directory for symlink `{}`.",
+ "Failed to create parent directory `{}` for symlink `{}`.",
+ parent.display(),
symlink_path.display()
)
})?; |
9410ccc to
f428f99
Compare
|
I've asked Codex to look for similar issues, and it found a few more, all addressed now, I hope. Let's see if your AI likes what my AI did ;-) |
071501f to
73fc417
Compare
IanButterworth
left a comment
There was a problem hiding this comment.
Just needs conflicts resolved
| - `juliaup override unset --path foo/bar` removes a directory override for the path `foo/bar`. | ||
| - `juliaup override unset --nonexistent` removes all directory overrides for paths that no longer exist. | ||
| - Tab completions for `juliaup` commands and `julia +channel` selection are automatically installed for Bash and Zsh (sourced from `~/.juliaup/completions/`). For other shells you can generate them manually, e.g. `juliaup completions fish > ~/.config/fish/completions/juliaup.fish`. Supported shells: `bash`, `zsh`, `fish`, `elvish`, `powershell`, and `nushell`. | ||
| - `juliaup completions bash > ~/.local/share/bash-completion/completions/juliaup` generates Bash completions for `juliaup` and saves them to a file. To use them, simply source this file in your `~/.bashrc`. Other supported shells are `zsh`, `fish`, `elvish` and `powershell`. |
There was a problem hiding this comment.
I let the AI do the merge. It messed up badly. I've now redone it manually
E.g. when failing to modify a file, include the path to the file Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Codex <codex@openai.com>
Replace production parent unwraps with contextual errors in symlink, install, and version-db code paths. Co-authored-by: Codex <codex@openai.com>
efbebfb to
c4db25a
Compare
E.g. when failing to modify a file, include the path to the file.
Resolves #1430.
Co-authored-by: Codex codex@openai.com