Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy patherrors.go
More file actions
Latest commit
156 lines (133 loc) · 5.03 KB
/
Copy patherrors.go
File metadata and controls
156 lines (133 loc) · 5.03 KB
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
package cloudops
import"fmt"
// Custom storage operation error codes.
const (
_=iota+5000
// ErrVolDetached is code for a volume is detached on the instance
ErrVolDetached
// ErrVolInval is the code for a invalid volume
ErrVolInval
// ErrVolAttachedOnRemoteNode is code when a volume is not attached locally
// but attached on a remote node
ErrVolAttachedOnRemoteNode
// ErrVolNotFound is code when a volume is not found
ErrVolNotFound
// ErrInvalidDevicePath is code when a volume/disk has invalid device path
ErrInvalidDevicePath
// ErrExponentialTimeout is code when all the retries with exponential backoff have exhausted
ErrExponentialTimeout
// ErrDiskGreaterOrEqualToExpandSize is code when a volume/disk expansion call fails
// as the given disk is already at a size greater than or equal to requested size
ErrDiskGreaterOrEqualToExpandSize
// ErrVolumeAttachedOnMultipleNodes is code when a volume is attached to multiple nodes
ErrVolumeAttachedOnMultipleNodes
)
// ErrNotFound is error type when an object of Type with ID is not found
typeErrNotFoundstruct {
// Type is the type of the object
Typestring
// ID is the unique identifer of the object
IDstring
}
func (e*ErrNotFound) Error() string {
returnfmt.Sprintf("%s with ID %s was not found", e.Type, e.ID)
}
// ErrNotSupported is the error type for unsupported operations
typeErrNotSupportedstruct {
// Operation is the operation not being supported
Operationstring
// Reason is an optional reason for not supporting the operation
Reasonstring
}
func (e*ErrNotSupported) Error() string {
errString:=fmt.Sprintf("Operation: %s is not supported", e.Operation)
iflen(e.Reason) >0 {
errString=fmt.Sprintf("%s. Reason: %s", errString, e.Reason)
}
returnerrString
}
// StorageError error returned for storage operations
typeStorageErrorstruct {
// Code is one of storage operation driver error codes.
Codeint
// Msg is human understandable error message.
Msgstring
// Instance provides more information on the error.
Instancestring
}
// NewStorageError creates a new custom storage error instance
funcNewStorageError(codeint, msgstring, instancestring) error {
return&StorageError{Code: code, Msg: msg, Instance: instance}
}
func (e*StorageError) Error() string {
returne.Msg
}
// ErrNoInstanceGroup is returned when instance doesn't belong to an instance group
typeErrNoInstanceGroupstruct {
// Reason is an optional reason for not belong to an instance group
Reasonstring
}
func (e*ErrNoInstanceGroup) Error() string {
errString:="Instance doesn't belong to an instance group"
iflen(e.Reason) >0 {
errString=fmt.Sprintf("%s. Reason: %s", errString, e.Reason)
}
returnerrString
}
// ErrInvalidStoragePoolUpdateRequest is returned when an unsupported or invalid request
// is sent to get the updated storage config on an instance
typeErrInvalidStoragePoolUpdateRequeststruct {
// Request is the request that caused the invalid error
Request*StoragePoolUpdateRequest
// Reason is the reason why the request was invalid
Reasonstring
}
func (e*ErrInvalidStoragePoolUpdateRequest) Error() string {
returnfmt.Sprintf("Invalid request to update storage on instance due to: %s Request: %v",
e.Reason, e.Request)
}
// ErrCurrentCapacityHigherThanDesired is returned when the current capacity of the instance is already higher than
// the desired capacity
typeErrCurrentCapacityHigherThanDesiredstruct {
// Current is the current capacity
Currentuint64
// Desired is the desired new capacity
Desireduint64
}
func (e*ErrCurrentCapacityHigherThanDesired) Error() string {
returnfmt.Sprintf("current capacity (%d) is higher than desired capacity: %d", e.Current, e.Desired)
}
// ErrCloudProviderRequestFailure is returned when an unknown API request failure occurred.
typeErrCloudProviderRequestFailurestruct {
// Request is the API function name
Requeststring
// Message is the error message returned by the cloud provider
Messagestring
}
func (e*ErrCloudProviderRequestFailure) Error() string {
returnfmt.Sprintf("Request %s returns %s", e.Request, e.Message)
}
// ErrInvalidMaxDriveSizeRequest is returned when an unsupported or invalid request
// is sent to get the max drive size
typeErrInvalidMaxDriveSizeRequeststruct {
// Request is the request that caused the invalid error
Request*MaxDriveSizeRequest
// Reason is the reason why the request was invalid
Reasonstring
}
func (e*ErrInvalidMaxDriveSizeRequest) Error() string {
returnfmt.Sprintf("Invalid request to get the max drive size: %s Request: %v",
e.Reason, e.Request)
}
// ErrMaxDriveSizeCandidateNotFound is returned when an unsupported or invalid request
// is sent to get the max drive size
typeErrMaxDriveSizeCandidateNotFoundstruct {
// Request is the request that caused the error
Request*MaxDriveSizeRequest
// Reason is the reason why the request caused an error
Reasonstring
}
func (e*ErrMaxDriveSizeCandidateNotFound) Error() string {
returnfmt.Sprintf("could not find a suitable max drive size candidate: %s Request: %v",
e.Reason, e.Request)
}