-
Notifications
You must be signed in to change notification settings - Fork 2
/
errors.go
179 lines (144 loc) · 3.83 KB
/
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
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
// Copyright 2020 StrongDM Inc
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package sdm
// Code generated by protogen. DO NOT EDIT.
// Error is a generic RPC error indicating something went wrong at the
// transport layer. Use Code() and Unwrap() to inspect the actual failed
// condition.
type Error interface {
// Code returns the gRPC error code
Code() int
error
}
// UnknownError is a generic wrapper that indicates an unknown internal error in the SDK.
type UnknownError struct {
// Wrapped is a underlying error.
Wrapped error
}
func (e *UnknownError) Error() string {
return e.Wrapped.Error()
}
func (e *UnknownError) Unwrap() error {
return e.Wrapped
}
func (e *UnknownError) Code() int {
return 2 // Unknown
}
// DeadlineExceededError indicates a timeout occurred.
type DeadlineExceededError struct {
// Wrapped is a underlying error.
Wrapped error
}
func (e *DeadlineExceededError) Error() string {
return "deadline exceeded"
}
func (e *DeadlineExceededError) Unwrap() error {
return e.Wrapped
}
func (e *DeadlineExceededError) Code() int {
return 4
}
// ContextCanceledError indicates an operation was canceled.
type ContextCanceledError struct {
// Wrapped is a underlying error.
Wrapped error
}
func (e *ContextCanceledError) Error() string {
return "context canceled"
}
func (e *ContextCanceledError) Unwrap() error {
return e.Wrapped
}
func (e *ContextCanceledError) Code() int {
return 1
}
// AlreadyExistsError is used when an entity already exists in the system
type AlreadyExistsError struct {
// Message is the error content.
Message string
}
func (e AlreadyExistsError) Error() string {
return e.Message
}
func (e AlreadyExistsError) Code() int {
return 6
}
// NotFoundError is used when an entity does not exist in the system
type NotFoundError struct {
// Message is the error content.
Message string
}
func (e NotFoundError) Error() string {
return e.Message
}
func (e NotFoundError) Code() int {
return 5
}
// BadRequestError identifies a bad request sent by the client
type BadRequestError struct {
// Message is the error content.
Message string
}
func (e BadRequestError) Error() string {
return e.Message
}
func (e BadRequestError) Code() int {
return 3
}
// AuthenticationError is used to specify an authentication failure condition
type AuthenticationError struct {
// Message is the error content.
Message string
}
func (e AuthenticationError) Error() string {
return e.Message
}
func (e AuthenticationError) Code() int {
return 16
}
// PermissionError is used to specify a permissions violation
type PermissionError struct {
// Message is the error content.
Message string
}
func (e PermissionError) Error() string {
return e.Message
}
func (e PermissionError) Code() int {
return 7
}
// InternalError is used to specify an internal system error
type InternalError struct {
// Message is the error content.
Message string
}
func (e InternalError) Error() string {
return e.Message
}
func (e InternalError) Code() int {
return 13
}
// RateLimitError is used for rate limit excess condition
type RateLimitError struct {
// Message is the error content.
Message string
// RateLimit provides information on the bucket in use, and by how much it was exceeded.
RateLimit *RateLimitMetadata
}
func (e RateLimitError) Error() string {
return e.Message
}
func (e RateLimitError) Code() int {
return 8
}