rclone/vendor/storj.io/common/errs2/rpc.go

18 lines
386 B
Go
Raw Normal View History

2020-05-11 20:57:46 +02:00
// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
package errs2
import (
"github.com/zeebo/errs"
"storj.io/common/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
})
}