mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 18:35:44 +03:00
move error
This commit is contained in:
@@ -11,6 +11,7 @@ const (
|
||||
errTokenNotFound = "ACL token not found"
|
||||
errPermissionDenied = "Permission denied"
|
||||
errNoNodeConn = "No path to node"
|
||||
errUnknownMethod = "unknown rpc method"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -19,6 +20,7 @@ var (
|
||||
ErrTokenNotFound = errors.New(errTokenNotFound)
|
||||
ErrPermissionDenied = errors.New(errPermissionDenied)
|
||||
ErrNoNodeConn = errors.New(errNoNodeConn)
|
||||
ErrUnknownMethod = errors.New(errUnknownMethod)
|
||||
)
|
||||
|
||||
// IsErrNoLeader returns whether the error is due to there being no leader.
|
||||
@@ -49,3 +51,9 @@ func IsErrPermissionDenied(err error) bool {
|
||||
func IsErrNoNodeConn(err error) bool {
|
||||
return err != nil && strings.Contains(err.Error(), errNoNodeConn)
|
||||
}
|
||||
|
||||
// IsErrUnknownMethod returns whether the error is due to the operation not
|
||||
// being allowed due to lack of permissions.
|
||||
func IsErrUnknownMethod(err error) bool {
|
||||
return err != nil && strings.Contains(err.Error(), errUnknownMethod)
|
||||
}
|
||||
|
||||
@@ -1,29 +1,10 @@
|
||||
package structs
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"io"
|
||||
"strings"
|
||||
"sync"
|
||||
)
|
||||
|
||||
// TODO(alexdadgar): move to errors.go
|
||||
const (
|
||||
errUnknownMethod = "unknown rpc method"
|
||||
)
|
||||
|
||||
var (
|
||||
// ErrUnknownMethod is used to indicate that the requested method
|
||||
// is unknown.
|
||||
ErrUnknownMethod = errors.New(errUnknownMethod)
|
||||
)
|
||||
|
||||
// IsErrUnknownMethod returns whether the error is due to the operation not
|
||||
// being allowed due to lack of permissions.
|
||||
func IsErrUnknownMethod(err error) bool {
|
||||
return err != nil && strings.Contains(err.Error(), errUnknownMethod)
|
||||
}
|
||||
|
||||
// StreamingRpcHeader is the first struct serialized after entering the
|
||||
// streaming RPC mode. The header is used to dispatch to the correct method.
|
||||
type StreamingRpcHeader struct {
|
||||
|
||||
Reference in New Issue
Block a user