-
Notifications
You must be signed in to change notification settings - Fork 104
/
error_keyvalue.go
30 lines (26 loc) · 1.28 KB
/
error_keyvalue.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
package gocb
import gocbcore "github.com/couchbase/gocbcore/v8"
// KeyValueError wraps key-value errors that occur within the SDK.
type KeyValueError struct {
InnerError error `json:"-"`
StatusCode gocbcore.StatusCode `json:"status_code,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"`
}
// Error returns the string representation of a kv error.
func (e KeyValueError) Error() string {
return e.InnerError.Error() + " | " + serializeWrappedError(e)
}
// Unwrap returns the underlying reason for the error
func (e KeyValueError) Unwrap() error {
return e.InnerError
}