mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #18625 from redwrasse/redwrasse/ep-command-errors-is
command: Use errors.Is for error equality check in ep_command.go
This commit is contained in:
commit
c79c7d5440
@ -15,6 +15,7 @@
|
|||||||
package command
|
package command
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"sync"
|
"sync"
|
||||||
@ -137,7 +138,7 @@ func epHealthCommandFunc(cmd *cobra.Command, args []string) {
|
|||||||
_, err = cli.Get(ctx, "health")
|
_, err = cli.Get(ctx, "health")
|
||||||
eh := epHealth{Ep: ep, Health: false, Took: time.Since(st).String()}
|
eh := epHealth{Ep: ep, Health: false, Took: time.Since(st).String()}
|
||||||
// permission denied is OK since proposal goes through consensus to get it
|
// permission denied is OK since proposal goes through consensus to get it
|
||||||
if err == nil || err == rpctypes.ErrPermissionDenied {
|
if err == nil || errors.Is(err, rpctypes.ErrPermissionDenied) {
|
||||||
eh.Health = true
|
eh.Health = true
|
||||||
} else {
|
} else {
|
||||||
eh.Error = err.Error()
|
eh.Error = err.Error()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user