Skip to content

Commit

Permalink
Move predicate err check earlier, inside RetryWithRelogin
Browse files Browse the repository at this point in the history
  • Loading branch information
kimlisa committed Jun 10, 2022
1 parent fd2b4a1 commit cfe3078
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 12 deletions.
4 changes: 4 additions & 0 deletions lib/client/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,10 @@ func RetryWithRelogin(ctx context.Context, tc *TeleportClient, fn func() error)
return nil
}

if utils.IsPredicateError(err) {
return trace.Wrap(utils.PredicateError{Err: err})
}

if !IsErrorResolvableWithRelogin(err) {
return trace.Wrap(err)
}
Expand Down
3 changes: 0 additions & 3 deletions tool/tsh/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ func onListDatabases(cf *CLIConf) error {
return trace.Wrap(err)
})
if err != nil {
if utils.IsPredicateError(err) {
return trace.Wrap(utils.PredicateError{Err: err})
}
return trace.Wrap(err)
}

Expand Down
3 changes: 0 additions & 3 deletions tool/tsh/kube.go
Original file line number Diff line number Diff line change
Expand Up @@ -958,9 +958,6 @@ func fetchKubeClusters(ctx context.Context, tc *client.TeleportClient) (teleport
}
return nil
}
if utils.IsPredicateError(err) {
return trace.Wrap(utils.PredicateError{Err: err})
}
return trace.Wrap(err)
}

Expand Down
6 changes: 0 additions & 6 deletions tool/tsh/tsh.go
Original file line number Diff line number Diff line change
Expand Up @@ -1644,9 +1644,6 @@ func onListNodes(cf *CLIConf) error {
return err
})
if err != nil {
if utils.IsPredicateError(err) {
return trace.Wrap(utils.PredicateError{Err: err})
}
return trace.Wrap(err)
}
sort.Slice(nodes, func(i, j int) bool {
Expand Down Expand Up @@ -3505,9 +3502,6 @@ func onApps(cf *CLIConf) error {
return err
})
if err != nil {
if utils.IsPredicateError(err) {
return trace.Wrap(utils.PredicateError{Err: err})
}
return trace.Wrap(err)
}

Expand Down

0 comments on commit cfe3078

Please sign in to comment.