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:
Benjamin Wang 2024-09-24 09:32:12 +01:00 committed by GitHub
commit c79c7d5440
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -15,6 +15,7 @@
package command
import (
"errors"
"fmt"
"os"
"sync"
@ -137,7 +138,7 @@ func epHealthCommandFunc(cmd *cobra.Command, args []string) {
_, err = cli.Get(ctx, "health")
eh := epHealth{Ep: ep, Health: false, Took: time.Since(st).String()}
// 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
} else {
eh.Error = err.Error()