forked from thecodeteam/libstorage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
types_errors.go
126 lines (96 loc) · 4.17 KB
/
types_errors.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
package types
import (
"github.com/akutz/goof"
)
// ErrNotImplemented is the error that Driver implementations should return if
// a function is not implemented.
var ErrNotImplemented = goof.New("not implemented")
// ErrTimedOut is the error that is used to indicate an operation timed out.
var ErrTimedOut = goof.New("timed out")
// ErrUnsupportedForClientType is the error that occurs when an operation is
// invoked that is unsupported for the current client type.
type ErrUnsupportedForClientType struct{ goof.Goof }
// ErrBadAdminToken occurs when a bad admin token is provided.
type ErrBadAdminToken struct{ goof.Goof }
// ErrNotFound occurs when a Driver inspects or sends an operation to a
// resource that cannot be found.
type ErrNotFound struct{ goof.Goof }
// ErrMissingLocalDevices occurs when an operation requires local devices
// and they're missing.
type ErrMissingLocalDevices struct{ goof.Goof }
// ErrMissingInstanceID occurs when an operation requires the instance ID for
// the configured service to be avaialble.
type ErrMissingInstanceID struct{ goof.Goof }
// ErrStoreKey occurs when no value exists for a specified store key.
type ErrStoreKey struct{ goof.Goof }
// ErrContextKey occurs when no value exists for a specified context key.
type ErrContextKey struct{ goof.Goof }
// ErrContextType occurs when a value exists in the context but is not the
// expected typed.
type ErrContextType struct{ goof.Goof }
// ErrDriverTypeErr occurs when a Driver is constructed with an invalid type.
type ErrDriverTypeErr struct{ goof.Goof }
// ErrBatchProcess occurs when a batch process is interrupted by an error
// before the process is complete. This error will contain information about
// the objects for which the process did complete.
type ErrBatchProcess struct{ goof.Goof }
// ErrBadFilter occurs when a bad filter is supplied via the filter query
// string.
type ErrBadFilter struct{ goof.Goof }
// ErrMissingStorageService occurs when the storage service is expected in
// the provided context but is not there.
var ErrMissingStorageService = goof.New("missing storage service")
// ErrSecTokInvalid occurs when a security token is invalid.
type ErrSecTokInvalid struct {
// InvalidToken is a flag that indicates whether or not the token was able
// to be parsed at all.
InvalidToken bool `json:"invalidToken"`
// InvalidSig is a flag that indicates whether or not the security token
// has a valid signature.
InvalidSig bool `json:"invalidSig"`
// MissingClaim is empty if all claims are missing or set to the name
// of the first, detected, missing claim.
MissingClaim string `json:"claim"`
// Denied is a flag that indicates whether or not the security token
// was denied access.
Denied bool
// InnerError is the inner error that caused this one.
InnerError error `json:"innerError,omitempty"`
}
// Error returns the error string.
func (e *ErrSecTokInvalid) Error() string {
return "invalid security token"
}
// ErrKnownHost occurs when the client's TLS dialer encounters a problem
// verifying the remote peer's certificate against a list of known host
// signatures.
type ErrKnownHost struct {
// HostName is the name of the host to which the connection was
// attempted.
HostName string
// PeerAlg is algorithm used to calculate the remote peer's fingerprint.
PeerAlg string
// PeerFingerprint is the remote peer's fingerprint.
PeerFingerprint []byte
}
func (e *ErrKnownHost) Error() string {
return "known host verification failed"
}
// ErrKnownHostConflict occurs when the client's TLS dialer encounters
// an existing known host entry for the targeted host name but with a
// different signature than the one being presented by the remote peer.
type ErrKnownHostConflict struct {
// HostName is the name of the host to which the connection was
// attempted.
HostName string
// KnownHostName is the name of the known host with an associated
// fingerprint that matches that of the remote peer.
KnownHostName string
// PeerAlg is algorithm used to calculate the remote peer's fingerprint.
PeerAlg string
// PeerFingerprint is the remote peer's fingerprint.
PeerFingerprint []byte
}
func (e *ErrKnownHostConflict) Error() string {
return "known host signature has changed"
}