Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UX: When identity file cannot be found, filename is not reported #496

Open
plaidfinch opened this issue May 5, 2024 · 0 comments
Open

Comments

@plaidfinch
Copy link

plaidfinch commented May 5, 2024

What were you trying to do

When using rage with agenix-rekey, an incorrect .. in a path in the Nix store meant that rage (called internally by agenix edit) could not find the specified identity file. In this case, the following error was returned:

Error: No such file or directory (os error 2)

[ Did rage not do what you expected? Could an error be more useful? ]
[ Tell us: https://str4d.xyz/rage/report                            ]

By comparison, the original go implementation made the error easy to diagnose, because it reports what path it tried to load:

age: error: reading "/nix/store/identities/age/age-yubikey-identity-83905597.txt.pub": failed to open file: open /nix/store/identities/age/age-yubikey-identity-83905597.txt.pub: no such file or directory
age: report unexpected or unhelpful errors at https://filippo.io/age/report

This immediately allowed me to understand what I'd done wrong.

Suggestion

When rage tries to read a file, perhaps it should wrap the error with a context (perhaps using anyhow or eyre?) that gives the filename in question. This primarily aids in usability when rage is called by a script or inside another tool, because when used alone on the command line it is usually obvious which file cannot be found, but in situations like the above, it would be very useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant