forked from couchbase/gocbcore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherrors_internal.go
746 lines (680 loc) · 27.1 KB
/
errors_internal.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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
package gocbcore
import (
"encoding/json"
"errors"
"fmt"
"time"
"github.com/couchbase/gocbcore/v10/memd"
)
type wrappedError struct {
Message string
InnerError error
}
func (e wrappedError) Error() string {
return fmt.Sprintf("%s: %s", e.Message, e.InnerError.Error())
}
func (e wrappedError) Unwrap() error {
return e.InnerError
}
func wrapError(err error, message string) error {
return wrappedError{
Message: message,
InnerError: err,
}
}
// SubDocumentError provides additional contextual information to
// sub-document specific errors. InnerError is always a KeyValueError.
type SubDocumentError struct {
InnerError error
Index int
}
// Error returns the string representation of this error.
func (err SubDocumentError) Error() string {
return fmt.Sprintf("sub-document error at index %d: %s",
err.Index,
err.InnerError.Error())
}
// Unwrap returns the underlying error for the operation failing.
func (err SubDocumentError) Unwrap() error {
return err.InnerError
}
func serializeError(err error) string {
errBytes, serErr := json.Marshal(err)
if serErr != nil {
logErrorf("failed to serialize error to json: %s", serErr.Error())
}
return string(errBytes)
}
// KeyValueError wraps key-value errors that occur within the SDK.
type KeyValueError struct {
InnerError error
StatusCode memd.StatusCode
DocumentKey string
BucketName string
ScopeName string
CollectionName string
CollectionID uint32
ErrorName string
ErrorDescription string
Opaque uint32
Context string
Ref string
RetryReasons []RetryReason
RetryAttempts uint32
LastDispatchedTo string
LastDispatchedFrom string
LastConnectionID string
}
// MarshalJSON implements the Marshaler interface.
func (e KeyValueError) MarshalJSON() ([]byte, error) {
return json.Marshal(struct {
InnerError string `json:"msg,omitempty"`
StatusCode memd.StatusCode `json:"status_code,omitempty"`
DocumentKey string `json:"document_key,omitempty"`
BucketName string `json:"bucket,omitempty"`
ScopeName string `json:"scope,omitempty"`
CollectionName string `json:"collection,omitempty"`
CollectionID uint32 `json:"collection_id,omitempty"`
ErrorName string `json:"error_name,omitempty"`
ErrorDescription string `json:"error_description,omitempty"`
Opaque uint32 `json:"opaque,omitempty"`
Context string `json:"context,omitempty"`
Ref string `json:"ref,omitempty"`
RetryReasons []RetryReason `json:"retry_reasons,omitempty"`
RetryAttempts uint32 `json:"retry_attempts,omitempty"`
LastDispatchedTo string `json:"last_dispatched_to,omitempty"`
LastDispatchedFrom string `json:"last_dispatched_from,omitempty"`
LastConnectionID string `json:"last_connection_id,omitempty"`
}{
InnerError: e.InnerError.Error(),
StatusCode: e.StatusCode,
DocumentKey: e.DocumentKey,
BucketName: e.BucketName,
ScopeName: e.ScopeName,
CollectionName: e.CollectionName,
CollectionID: e.CollectionID,
ErrorName: e.ErrorName,
ErrorDescription: e.ErrorDescription,
Opaque: e.Opaque,
Context: e.Context,
Ref: e.Ref,
RetryReasons: e.RetryReasons,
RetryAttempts: e.RetryAttempts,
LastDispatchedTo: e.LastDispatchedTo,
LastDispatchedFrom: e.LastDispatchedFrom,
LastConnectionID: e.LastConnectionID,
})
}
// Error returns the string representation of this error.
func (e KeyValueError) Error() string {
errBytes, serErr := json.Marshal(struct {
InnerError error `json:"-"`
StatusCode memd.StatusCode `json:"status_code,omitempty"`
DocumentKey string `json:"document_key,omitempty"`
BucketName string `json:"bucket,omitempty"`
ScopeName string `json:"scope,omitempty"`
CollectionName string `json:"collection,omitempty"`
CollectionID uint32 `json:"collection_id,omitempty"`
ErrorName string `json:"error_name,omitempty"`
ErrorDescription string `json:"error_description,omitempty"`
Opaque uint32 `json:"opaque,omitempty"`
Context string `json:"context,omitempty"`
Ref string `json:"ref,omitempty"`
RetryReasons []RetryReason `json:"retry_reasons,omitempty"`
RetryAttempts uint32 `json:"retry_attempts,omitempty"`
LastDispatchedTo string `json:"last_dispatched_to,omitempty"`
LastDispatchedFrom string `json:"last_dispatched_from,omitempty"`
LastConnectionID string `json:"last_connection_id,omitempty"`
}{
InnerError: e.InnerError,
StatusCode: e.StatusCode,
DocumentKey: e.DocumentKey,
BucketName: e.BucketName,
ScopeName: e.ScopeName,
CollectionName: e.CollectionName,
CollectionID: e.CollectionID,
ErrorName: e.ErrorName,
ErrorDescription: e.ErrorDescription,
Opaque: e.Opaque,
Context: e.Context,
Ref: e.Ref,
RetryReasons: e.RetryReasons,
RetryAttempts: e.RetryAttempts,
LastDispatchedTo: e.LastDispatchedTo,
LastDispatchedFrom: e.LastDispatchedFrom,
LastConnectionID: e.LastConnectionID,
})
if serErr != nil {
logErrorf("failed to serialize error to json: %s", serErr.Error())
}
return e.InnerError.Error() + " | " + string(errBytes)
}
// Unwrap returns the underlying reason for the error
func (e KeyValueError) Unwrap() error {
return e.InnerError
}
// ViewQueryErrorDesc represents specific view error data.
type ViewQueryErrorDesc struct {
SourceNode string
Message string
}
// ViewError represents an error returned from a view query.
type ViewError struct {
InnerError error
DesignDocumentName string
ViewName string
Errors []ViewQueryErrorDesc
Endpoint string
RetryReasons []RetryReason
RetryAttempts uint32
// Uncommitted: This API may change in the future.
ErrorText string
// Uncommitted: This API may change in the future.
HTTPResponseCode int
}
// MarshalJSON implements the Marshaler interface.
func (e ViewError) MarshalJSON() ([]byte, error) {
return json.Marshal(struct {
InnerError string `json:"msg,omitempty"`
DesignDocumentName string `json:"design_document_name,omitempty"`
ViewName string `json:"view_name,omitempty"`
Errors []ViewQueryErrorDesc `json:"errors,omitempty"`
Endpoint string `json:"endpoint,omitempty"`
RetryReasons []RetryReason `json:"retry_reasons,omitempty"`
RetryAttempts uint32 `json:"retry_attempts,omitempty"`
HTTPResponseCode int `json:"status_code,omitempty"`
}{
InnerError: e.InnerError.Error(),
DesignDocumentName: e.DesignDocumentName,
ViewName: e.ViewName,
Errors: e.Errors,
Endpoint: e.Endpoint,
RetryReasons: e.RetryReasons,
RetryAttempts: e.RetryAttempts,
HTTPResponseCode: e.HTTPResponseCode,
})
}
// Error returns the string representation of this error.
func (e ViewError) Error() string {
errBytes, serErr := json.Marshal(struct {
InnerError error `json:"-"`
DesignDocumentName string `json:"design_document_name,omitempty"`
ViewName string `json:"view_name,omitempty"`
Errors []ViewQueryErrorDesc `json:"errors,omitempty"`
Endpoint string `json:"endpoint,omitempty"`
RetryReasons []RetryReason `json:"retry_reasons,omitempty"`
RetryAttempts uint32 `json:"retry_attempts,omitempty"`
ErrorText string `json:"error_text,omitempty"`
HTTPResponseCode int `json:"status_code,omitempty"`
}{
InnerError: e.InnerError,
DesignDocumentName: e.DesignDocumentName,
ViewName: e.ViewName,
Errors: e.Errors,
Endpoint: e.Endpoint,
RetryReasons: e.RetryReasons,
RetryAttempts: e.RetryAttempts,
ErrorText: e.ErrorText,
HTTPResponseCode: e.HTTPResponseCode,
})
if serErr != nil {
logErrorf("failed to serialize error to json: %s", serErr.Error())
}
return e.InnerError.Error() + " | " + string(errBytes)
}
// Unwrap returns the underlying reason for the error
func (e ViewError) Unwrap() error {
return e.InnerError
}
// N1QLErrorDesc represents specific n1ql error data.
type N1QLErrorDesc struct {
Code uint32
Message string
Retry bool
Reason map[string]interface{}
}
// MarshalJSON implements the Marshaler interface.
func (e N1QLErrorDesc) MarshalJSON() ([]byte, error) {
return json.Marshal(struct {
Code uint32 `json:"code"`
Message string `json:"message"`
Retry bool `json:"retry,omitempty"`
Reason map[string]interface{} `json:"reason,omitempty"`
}{
Code: e.Code,
Message: e.Message,
Retry: e.Retry,
Reason: e.Reason,
})
}
// N1QLError represents an error returned from a n1ql query.
type N1QLError struct {
InnerError error
Statement string
ClientContextID string
Errors []N1QLErrorDesc
Endpoint string
RetryReasons []RetryReason
RetryAttempts uint32
// Uncommitted: This API may change in the future.
ErrorText string
// Uncommitted: This API may change in the future.
HTTPResponseCode int
}
// MarshalJSON implements the Marshaler interface.
func (e N1QLError) MarshalJSON() ([]byte, error) {
return json.Marshal(struct {
InnerError string `json:"msg,omitempty"`
Statement string `json:"statement,omitempty"`
ClientContextID string `json:"client_context_id,omitempty"`
Errors []N1QLErrorDesc `json:"errors,omitempty"`
Endpoint string `json:"endpoint,omitempty"`
RetryReasons []RetryReason `json:"retry_reasons,omitempty"`
RetryAttempts uint32 `json:"retry_attempts,omitempty"`
HTTPResponseCode int `json:"status_code,omitempty"`
}{
InnerError: e.InnerError.Error(),
Statement: e.Statement,
ClientContextID: e.ClientContextID,
Errors: e.Errors,
Endpoint: e.Endpoint,
RetryReasons: e.RetryReasons,
RetryAttempts: e.RetryAttempts,
HTTPResponseCode: e.HTTPResponseCode,
})
}
// Error returns the string representation of this error.
func (e N1QLError) Error() string {
errBytes, serErr := json.Marshal(struct {
InnerError error `json:"-"`
Statement string `json:"statement,omitempty"`
ClientContextID string `json:"client_context_id,omitempty"`
Errors []N1QLErrorDesc `json:"errors,omitempty"`
Endpoint string `json:"endpoint,omitempty"`
RetryReasons []RetryReason `json:"retry_reasons,omitempty"`
RetryAttempts uint32 `json:"retry_attempts,omitempty"`
ErrorText string `json:"error_text,omitempty"`
HTTPResponseCode int `json:"status_code,omitempty"`
}{
InnerError: e.InnerError,
Statement: e.Statement,
ClientContextID: e.ClientContextID,
Errors: e.Errors,
Endpoint: e.Endpoint,
RetryReasons: e.RetryReasons,
RetryAttempts: e.RetryAttempts,
ErrorText: e.ErrorText,
HTTPResponseCode: e.HTTPResponseCode,
})
if serErr != nil {
logErrorf("failed to serialize error to json: %s", serErr.Error())
}
return e.InnerError.Error() + " | " + string(errBytes)
}
// Unwrap returns the underlying reason for the error
func (e N1QLError) Unwrap() error {
return e.InnerError
}
// AnalyticsErrorDesc represents specific analytics error data.
type AnalyticsErrorDesc struct {
Code uint32
Message string
}
// AnalyticsError represents an error returned from an analytics query.
type AnalyticsError struct {
InnerError error
Statement string
ClientContextID string
Errors []AnalyticsErrorDesc
Endpoint string
RetryReasons []RetryReason
RetryAttempts uint32
// Uncommitted: This API may change in the future.
ErrorText string
// Uncommitted: This API may change in the future.
HTTPResponseCode int
}
// MarshalJSON implements the Marshaler interface.
func (e AnalyticsError) MarshalJSON() ([]byte, error) {
return json.Marshal(struct {
InnerError string `json:"msg,omitempty"`
Statement string `json:"statement,omitempty"`
ClientContextID string `json:"client_context_id,omitempty"`
Errors []AnalyticsErrorDesc `json:"errors,omitempty"`
Endpoint string `json:"endpoint,omitempty"`
RetryReasons []RetryReason `json:"retry_reasons,omitempty"`
RetryAttempts uint32 `json:"retry_attempts,omitempty"`
HTTPResponseCode int `json:"status_code,omitempty"`
}{
InnerError: e.InnerError.Error(),
Statement: e.Statement,
ClientContextID: e.ClientContextID,
Errors: e.Errors,
Endpoint: e.Endpoint,
RetryReasons: e.RetryReasons,
RetryAttempts: e.RetryAttempts,
HTTPResponseCode: e.HTTPResponseCode,
})
}
// Error returns the string representation of this error.
func (e AnalyticsError) Error() string {
errBytes, serErr := json.Marshal(struct {
InnerError error `json:"-"`
Statement string `json:"statement,omitempty"`
ClientContextID string `json:"client_context_id,omitempty"`
Errors []AnalyticsErrorDesc `json:"errors,omitempty"`
Endpoint string `json:"endpoint,omitempty"`
RetryReasons []RetryReason `json:"retry_reasons,omitempty"`
RetryAttempts uint32 `json:"retry_attempts,omitempty"`
ErrorText string `json:"error_text,omitempty"`
HTTPResponseCode int `json:"status_code,omitempty"`
}{
InnerError: e.InnerError,
Statement: e.Statement,
ClientContextID: e.ClientContextID,
Errors: e.Errors,
Endpoint: e.Endpoint,
RetryReasons: e.RetryReasons,
RetryAttempts: e.RetryAttempts,
ErrorText: e.ErrorText,
HTTPResponseCode: e.HTTPResponseCode,
})
if serErr != nil {
logErrorf("failed to serialize error to json: %s", serErr.Error())
}
return e.InnerError.Error() + " | " + string(errBytes)
}
// Unwrap returns the underlying reason for the error
func (e AnalyticsError) Unwrap() error {
return e.InnerError
}
// SearchError represents an error returned from a search query.
type SearchError struct {
InnerError error
IndexName string
Query interface{}
ErrorText string
HTTPResponseCode int
Endpoint string
RetryReasons []RetryReason
RetryAttempts uint32
}
// MarshalJSON implements the Marshaler interface.
func (e SearchError) MarshalJSON() ([]byte, error) {
return json.Marshal(struct {
InnerError string `json:"msg,omitempty"`
IndexName string `json:"index_name,omitempty"`
Query interface{} `json:"query,omitempty"`
ErrorText string `json:"error_text"`
HTTPResponseCode int `json:"status_code,omitempty"`
Endpoint string `json:"endpoint,omitempty"`
RetryReasons []RetryReason `json:"retry_reasons,omitempty"`
RetryAttempts uint32 `json:"retry_attempts,omitempty"`
}{
InnerError: e.InnerError.Error(),
IndexName: e.IndexName,
Query: e.Query,
ErrorText: e.ErrorText,
HTTPResponseCode: e.HTTPResponseCode,
Endpoint: e.Endpoint,
RetryReasons: e.RetryReasons,
RetryAttempts: e.RetryAttempts,
})
}
// Error returns the string representation of this error.
func (e SearchError) Error() string {
errBytes, serErr := json.Marshal(struct {
InnerError error `json:"-"`
IndexName string `json:"index_name,omitempty"`
Query interface{} `json:"query,omitempty"`
ErrorText string `json:"error_text"`
HTTPResponseCode int `json:"status_code,omitempty"`
Endpoint string `json:"endpoint,omitempty"`
RetryReasons []RetryReason `json:"retry_reasons,omitempty"`
RetryAttempts uint32 `json:"retry_attempts,omitempty"`
}{
InnerError: e.InnerError,
IndexName: e.IndexName,
Query: e.Query,
ErrorText: e.ErrorText,
HTTPResponseCode: e.HTTPResponseCode,
Endpoint: e.Endpoint,
RetryReasons: e.RetryReasons,
RetryAttempts: e.RetryAttempts,
})
if serErr != nil {
logErrorf("failed to serialize error to json: %s", serErr.Error())
}
return e.InnerError.Error() + " | " + string(errBytes)
}
// Unwrap returns the underlying reason for the error
func (e SearchError) Unwrap() error {
return e.InnerError
}
// HTTPError represents an error returned from an HTTP request.
type HTTPError struct {
InnerError error
UniqueID string
Endpoint string
RetryReasons []RetryReason
RetryAttempts uint32
}
// MarshalJSON implements the Marshaler interface.
func (e HTTPError) MarshalJSON() ([]byte, error) {
return json.Marshal(struct {
InnerError string `json:"msg,omitempty"`
UniqueID string `json:"unique_id,omitempty"`
Endpoint string `json:"endpoint,omitempty"`
RetryReasons []RetryReason `json:"retry_reasons,omitempty"`
RetryAttempts uint32 `json:"retry_attempts,omitempty"`
}{
InnerError: e.InnerError.Error(),
UniqueID: e.UniqueID,
Endpoint: e.Endpoint,
RetryReasons: e.RetryReasons,
RetryAttempts: e.RetryAttempts,
})
}
// Error returns the string representation of this error.
func (e HTTPError) Error() string {
errBytes, serErr := json.Marshal(struct {
InnerError error `json:"-"`
UniqueID string `json:"unique_id,omitempty"`
Endpoint string `json:"endpoint,omitempty"`
RetryReasons []RetryReason `json:"retry_reasons,omitempty"`
RetryAttempts uint32 `json:"retry_attempts,omitempty"`
}{
InnerError: e.InnerError,
UniqueID: e.UniqueID,
Endpoint: e.Endpoint,
RetryReasons: e.RetryReasons,
RetryAttempts: e.RetryAttempts,
})
if serErr != nil {
logErrorf("failed to serialize error to json: %s", serErr.Error())
}
return e.InnerError.Error() + " | " + string(errBytes)
}
// Unwrap returns the underlying reason for the error
func (e HTTPError) Unwrap() error {
return e.InnerError
}
// TimeoutError wraps timeout errors that occur within the SDK.
type TimeoutError struct {
InnerError error
OperationID string
Opaque string
TimeObserved time.Duration
RetryReasons []RetryReason
RetryAttempts uint32
LastDispatchedTo string
LastDispatchedFrom string
LastConnectionID string
}
type timeoutError struct {
InnerError error `json:"-,omitempty"`
OperationID string `json:"s,omitempty"`
Opaque string `json:"i,omitempty"`
TimeObserved uint64 `json:"t,omitempty"`
RetryReasons []RetryReason `json:"rr,omitempty"`
RetryAttempts uint32 `json:"ra,omitempty"`
LastDispatchedTo string `json:"r,omitempty"`
LastDispatchedFrom string `json:"l,omitempty"`
LastConnectionID string `json:"c,omitempty"`
}
// MarshalJSON implements the Marshaler interface.
func (err *TimeoutError) MarshalJSON() ([]byte, error) {
toMarshal := timeoutError{
InnerError: err.InnerError,
OperationID: err.OperationID,
Opaque: err.Opaque,
TimeObserved: uint64(err.TimeObserved / time.Microsecond),
RetryReasons: err.RetryReasons,
RetryAttempts: err.RetryAttempts,
LastDispatchedTo: err.LastDispatchedTo,
LastDispatchedFrom: err.LastDispatchedFrom,
LastConnectionID: err.LastConnectionID,
}
return json.Marshal(toMarshal)
}
// UnmarshalJSON implements the Unmarshaler interface.
func (err *TimeoutError) UnmarshalJSON(data []byte) error {
var tErr timeoutError
if jErr := json.Unmarshal(data, &tErr); jErr != nil {
return jErr
}
duration := time.Duration(tErr.TimeObserved) * time.Microsecond
err.InnerError = tErr.InnerError
err.OperationID = tErr.OperationID
err.Opaque = tErr.Opaque
err.TimeObserved = duration
err.RetryReasons = tErr.RetryReasons
err.RetryAttempts = tErr.RetryAttempts
err.LastDispatchedTo = tErr.LastDispatchedTo
err.LastDispatchedFrom = tErr.LastDispatchedFrom
err.LastConnectionID = tErr.LastConnectionID
return nil
}
func (err TimeoutError) Error() string {
return err.InnerError.Error() + " | " + serializeError(err)
}
// Unwrap returns the underlying reason for the error
func (err TimeoutError) Unwrap() error {
return err.InnerError
}
// ncError is a wrapper error that provides no additional context to one of the
// publicly exposed error types. This is to force people to correctly use the
// error handling behaviours to check the error, rather than direct compares.
type ncError struct {
InnerError error
}
func (err ncError) Error() string {
return err.InnerError.Error()
}
func (err ncError) Unwrap() error {
return err.InnerError
}
func isErrorStatus(err error, code memd.StatusCode) bool {
var kvErr *KeyValueError
if errors.As(err, &kvErr) {
return kvErr.StatusCode == code
}
return false
}
var (
// errCircuitBreakerOpen is passed around internally to signal that an
// operation was cancelled due to the circuit breaker being open.
errCircuitBreakerOpen = errors.New("circuit breaker open")
errNoCCCPHosts = errors.New("no cccp hosts available")
)
// This list contains protected versions of all the errors we throw
// to ensure no users inadvertently rely on direct comparisons.
// nolint: deadcode,varcheck
var (
errTimeout = ncError{ErrTimeout}
errRequestCanceled = ncError{ErrRequestCanceled}
errInvalidArgument = ncError{ErrInvalidArgument}
errServiceNotAvailable = ncError{ErrServiceNotAvailable}
errInternalServerFailure = ncError{ErrInternalServerFailure}
errAuthenticationFailure = ncError{ErrAuthenticationFailure}
errTemporaryFailure = ncError{ErrTemporaryFailure}
errParsingFailure = ncError{ErrParsingFailure}
errCasMismatch = ncError{ErrCasMismatch}
errBucketNotFound = ncError{ErrBucketNotFound}
errCollectionNotFound = ncError{ErrCollectionNotFound}
errEncodingFailure = ncError{ErrEncodingFailure}
errDecodingFailure = ncError{ErrDecodingFailure}
errUnsupportedOperation = ncError{ErrUnsupportedOperation}
errAmbiguousTimeout = ncError{ErrAmbiguousTimeout}
errUnambiguousTimeout = ncError{ErrUnambiguousTimeout}
errFeatureNotAvailable = ncError{ErrFeatureNotAvailable}
errScopeNotFound = ncError{ErrScopeNotFound}
errIndexNotFound = ncError{ErrIndexNotFound}
errIndexExists = ncError{ErrIndexExists}
errGCCCPInUse = ncError{ErrGCCCPInUse}
errNotMyVBucket = ncError{ErrNotMyVBucket}
errDMLFailure = ncError{ErrDMLFailure}
errMemdClientClosed = ncError{ErrMemdClientClosed}
errRequestAlreadyDispatched = ncError{ErrRequestAlreadyDispatched}
errDocumentNotFound = ncError{ErrDocumentNotFound}
errDocumentUnretrievable = ncError{ErrDocumentUnretrievable}
errDocumentLocked = ncError{ErrDocumentLocked}
errValueTooLarge = ncError{ErrValueTooLarge}
errDocumentExists = ncError{ErrDocumentExists}
errValueNotJSON = ncError{ErrValueNotJSON}
errDurabilityLevelNotAvailable = ncError{ErrDurabilityLevelNotAvailable}
errDurabilityImpossible = ncError{ErrDurabilityImpossible}
errDurabilityAmbiguous = ncError{ErrDurabilityAmbiguous}
errDurableWriteInProgress = ncError{ErrDurableWriteInProgress}
errDurableWriteReCommitInProgress = ncError{ErrDurableWriteReCommitInProgress}
errMutationLost = ncError{ErrMutationLost}
errPathNotFound = ncError{ErrPathNotFound}
errPathMismatch = ncError{ErrPathMismatch}
errPathInvalid = ncError{ErrPathInvalid}
errPathTooBig = ncError{ErrPathTooBig}
errPathTooDeep = ncError{ErrPathTooDeep}
errValueTooDeep = ncError{ErrValueTooDeep}
errValueInvalid = ncError{ErrValueInvalid}
errDocumentNotJSON = ncError{ErrDocumentNotJSON}
errNumberTooBig = ncError{ErrNumberTooBig}
errDeltaInvalid = ncError{ErrDeltaInvalid}
errPathExists = ncError{ErrPathExists}
errXattrUnknownMacro = ncError{ErrXattrUnknownMacro}
errXattrInvalidFlagCombo = ncError{ErrXattrInvalidFlagCombo}
errXattrInvalidKeyCombo = ncError{ErrXattrInvalidKeyCombo}
errXattrUnknownVirtualAttribute = ncError{ErrXattrUnknownVirtualAttribute}
errXattrCannotModifyVirtualAttribute = ncError{ErrXattrCannotModifyVirtualAttribute}
errXattrInvalidOrder = ncError{ErrXattrInvalidOrder}
errPlanningFailure = ncError{ErrPlanningFailure}
errIndexFailure = ncError{ErrIndexFailure}
errPreparedStatementFailure = ncError{ErrPreparedStatementFailure}
errCompilationFailure = ncError{ErrCompilationFailure}
errJobQueueFull = ncError{ErrJobQueueFull}
errDatasetNotFound = ncError{ErrDatasetNotFound}
errDataverseNotFound = ncError{ErrDataverseNotFound}
errDatasetExists = ncError{ErrDatasetExists}
errDataverseExists = ncError{ErrDataverseExists}
errLinkNotFound = ncError{ErrLinkNotFound}
errViewNotFound = ncError{ErrViewNotFound}
errDesignDocumentNotFound = ncError{ErrDesignDocumentNotFound}
errNoSupportedMechanisms = ncError{ErrNoSupportedMechanisms}
errBadHosts = ncError{ErrBadHosts}
errProtocol = ncError{ErrProtocol}
errNoReplicas = ncError{ErrNoReplicas}
errCliInternalError = ncError{ErrCliInternalError}
errInvalidCredentials = ncError{ErrInvalidCredentials}
errInvalidServer = ncError{ErrInvalidServer}
errInvalidVBucket = ncError{ErrInvalidVBucket}
errInvalidReplica = ncError{ErrInvalidReplica}
errInvalidService = ncError{ErrInvalidService}
errInvalidCertificate = ncError{ErrInvalidCertificate}
errCollectionsUnsupported = ncError{ErrCollectionsUnsupported}
errBucketAlreadySelected = ncError{ErrBucketAlreadySelected}
errShutdown = ncError{ErrShutdown}
errOverload = ncError{ErrOverload}
errStreamIDNotEnabled = ncError{ErrStreamIDNotEnabled}
errDCPStreamIDInvalid = ncError{ErrDCPStreamIDInvalid}
errForcedReconnect = ncError{ErrForcedReconnect}
errRateLimitedFailure = ncError{ErrRateLimitedFailure}
errQuotaLimitedFailure = ncError{ErrQuotaLimitedFailure}
)