Skip to content

Commit

Permalink
add more info in error
Browse files Browse the repository at this point in the history
Signed-off-by: Leavrth <jianjun.liao@outlook.com>
  • Loading branch information
Leavrth committed Feb 7, 2023
1 parent 4392e9a commit 12a5731
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion br/pkg/task/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ func IsStreamRestore(cmdName string) bool {
// RunRestore starts a restore task inside the current goroutine.
func RunRestore(c context.Context, g glue.Glue, cmdName string, cfg *RestoreConfig) error {
if err := checkTaskExists(c, cfg); err != nil {
return errors.Trace(err)
return errors.Annotate(err, "failed to check task exits")
}

config.UpdateGlobal(func(conf *config.Config) {
Expand Down
6 changes: 5 additions & 1 deletion br/pkg/task/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,11 @@ func checkTaskExists(ctx context.Context, cfg *RestoreConfig) error {
return err
}
cli := streamhelper.NewMetaDataClient(etcdCLI)
defer cli.Close()
defer func() {
if err := cli.Close(); err != nil {
log.Error("failed to close the etcd client", zap.Error(err))
}
}()
tasks, err := cli.GetAllTasks(ctx)
if err != nil {
return err
Expand Down

0 comments on commit 12a5731

Please sign in to comment.