mirror of
https://github.com/rclone/rclone.git
synced 2024-12-11 17:51:12 +01:00
18 lines
386 B
Go
18 lines
386 B
Go
|
// 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
|
||
|
})
|
||
|
}
|