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

fix(cli/rm/rm.go): using panic is not user friendly #1608

Merged
merged 3 commits into from
May 17, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions cmd/ooniprobe/internal/cli/rm/rm.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"github.com/apex/log"
"github.com/ooni/probe-cli/v3/cmd/ooniprobe/internal/cli/root"
"github.com/ooni/probe-cli/v3/internal/database"
"github.com/ooni/probe-cli/v3/internal/runtimex"
"github.com/upper/db/v4"
)

Expand All @@ -21,7 +20,7 @@ func deleteAll(d *database.Database, skipInteractive bool) error {
Options: []string{"true", "false"},
Default: "false",
}
runtimex.Try0(survey.AskOne(confirm, &answer, nil))
_ = survey.AskOne(confirm, &answer, nil) // no error checking: we rely on the default
bassosimone marked this conversation as resolved.
Show resolved Hide resolved
if answer == "false" {
return errors.New("canceled by user")
}
Expand Down Expand Up @@ -81,7 +80,7 @@ func init() {
Options: []string{"true", "false"},
Default: "false",
}
runtimex.Try0(survey.AskOne(confirm, &answer, nil))
_ = survey.AskOne(confirm, &answer, nil) // no error checking: we rely on the default
bassosimone marked this conversation as resolved.
Show resolved Hide resolved
if answer == "false" {
return errors.New("canceled by user")
}
Expand Down
Loading