Skip to content

Commit bd7edd5

Browse files
authored
Change error message for devbox add when a package is not found (#1088)
## 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 ```
1 parent a262da5 commit bd7edd5

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

internal/boxcli/add.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"go.jetpack.io/devbox/internal/nix"
1414
)
1515

16-
const toSearchForPackages = "To search for packages use https://search.nixos.org/packages"
16+
const toSearchForPackages = "To search for packages, use the `devbox search` command"
1717

1818
type addCmdFlags struct {
1919
config configFlags

internal/searcher/client.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"go.jetpack.io/devbox/internal/boxcli/usererr"
1515
"go.jetpack.io/devbox/internal/envir"
1616
"go.jetpack.io/devbox/internal/lock"
17+
"go.jetpack.io/devbox/internal/nix"
1718
)
1819

1920
const searchAPIEndpoint = "https://search.devbox.sh"
@@ -60,7 +61,7 @@ func (c *client) Resolve(pkg string) (*lock.Package, error) {
6061
return nil, err
6162
}
6263
if len(result.Results) == 0 {
63-
return nil, usererr.New("No results found for %q.", pkg)
64+
return nil, nix.ErrPackageNotFound
6465
}
6566
return &lock.Package{
6667
LastModified: result.Results[0].Packages[0].Date,

0 commit comments

Comments
 (0)