Skip to content

Commit

Permalink
machine/store: modify connect() return value
Browse files Browse the repository at this point in the history
Modified fmt.Errorf() in connect() function.
When executing `kraft ps` in user state, error reporting would have a redundant prompt message.
Distinguished between basic errors, and the added annotated errors.

Signed-off-by: Zeyu Li <mr.lizeyu@outlook.com>
  • Loading branch information
zyllee committed May 24, 2023
1 parent 9b35126 commit ce7b09a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions machine/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ import (
"path/filepath"
"time"

"github.com/dgraph-io/badger/v3"
"github.com/juju/errors"
"kraftkit.sh/config"
"kraftkit.sh/internal/retrytimeout"

"github.com/dgraph-io/badger/v3"
)

type MachineStore struct {
Expand Down Expand Up @@ -109,12 +109,12 @@ func (ms *MachineStore) connect() error {
var err error
db, err = badger.Open(ms.bopts)
if err != nil {
return fmt.Errorf("could not open machine store: %v", err)
return errors.Errorf("%v", err)
}

return nil
}); err != nil {
return fmt.Errorf("could not open machine store: %v", err)
return errors.Annotate(err, "could not open machine store")
}

ms.db = db
Expand Down

0 comments on commit ce7b09a

Please sign in to comment.