Skip to content

Change error message for devbox add when a package is not found #1088

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

Merged
merged 2 commits into from
Jun 2, 2023

Conversation

LucilleH
Copy link
Collaborator

@LucilleH LucilleH commented Jun 2, 2023

Summary

Change error message for devbox add when a package is not found. To repro:
devbox add hellow@latest

Original output:

Error: No results found for "hellow@latest".

New output:

Error: No results found for "hellow@latest".

To search for packages, use the `devbox search` command

How was it tested?

devbox run build
devbox add hellow@latest

@LucilleH LucilleH force-pushed the lucille--change-error-msg branch from 112e938 to f4f29af Compare June 2, 2023 18:16
@LucilleH LucilleH requested a review from mikeland73 June 2, 2023 18:16
@@ -37,7 +36,7 @@ func addCmd() *cobra.Command {
return nil
}
err := addCmdFunc(cmd, args, flags)
if errors.Is(err, nix.ErrPackageNotFound) {
if err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will mask any other error (including not logging them to Sentry)

I think we should change https://github.com/jetpack-io/devbox/blob/main/internal/searcher/client.go#L63-L63 to return ErrPackageNotFound (maybe move it to searcher pkg) so we only show this error message for that error.

There's also this potential error as well: https://github.com/jetpack-io/devbox/blob/main/internal/nix/input.go#L260-L260

not sure if we need any special handling for that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just checked, no need for https://github.com/jetpack-io/devbox/blob/main/internal/nix/input.go#L260-L260 as that only happens when a user does:

devbox add nodejs@

with the @ but no version

@LucilleH LucilleH requested a review from mikeland73 June 2, 2023 18:35
@LucilleH LucilleH merged commit bd7edd5 into main Jun 2, 2023
@LucilleH LucilleH deleted the lucille--change-error-msg branch June 2, 2023 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants