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

Improve error message for -monitor on local lake #4979

Merged
merged 1 commit into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 5 additions & 2 deletions cli/lakeflags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ import (
"go.uber.org/zap"
)

var ErrNoHEAD = errors.New("HEAD not specified: indicate with -use or run the \"use\" command")
var (
ErrNoHEAD = errors.New("HEAD not specified: indicate with -use or run the \"use\" command")
ErrLocalLake = errors.New("cannot open connection on local lake")
)

type Flags struct {
ConfigDir string
Expand Down Expand Up @@ -49,7 +52,7 @@ func (l *Flags) Connection() (*client.Connection, error) {
return nil, err
}
if !api.IsLakeService(uri.String()) {
return nil, errors.New("cannot open connection on local lake")
return nil, ErrLocalLake
}
conn := client.NewConnectionTo(uri.String())
if err := conn.SetAuthStore(l.AuthStore()); err != nil {
Expand Down
5 changes: 5 additions & 0 deletions cmd/zed/manage/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ package manage

import (
"bytes"
"errors"
"flag"
"os"

"github.com/brimdata/zed/cli/lakeflags"
"github.com/brimdata/zed/cli/logflags"
"github.com/brimdata/zed/cmd/zed/manage/lakemanage"
"github.com/brimdata/zed/cmd/zed/root"
Expand Down Expand Up @@ -58,6 +60,9 @@ func (c *Command) Run(args []string) error {
if c.monitor {
conn, err := c.LakeFlags.Connection()
if err != nil {
if errors.Is(err, lakeflags.ErrLocalLake) {
return errors.New("monitor on local lake not supported")
}
return err
}
return lakemanage.Monitor(ctx, conn, c.config, logger)
Expand Down