storj/private/errs2/rpc.go
2019-11-14 21:46:15 +02:00

18 lines
389 B
Go

// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
package errs2
import (
"github.com/zeebo/errs"
"storj.io/storj/pkg/rpc/rpcstatus"
)
// IsRPC checks if err contains an RPC error with the given status code.
func IsRPC(err error, code rpcstatus.StatusCode) bool {
return errs.IsFunc(err, func(err error) bool {
return rpcstatus.Code(err) == code
})
}