Documentation ¶
Index ¶
- Constants
- func IsArangoErrorWithCode(err error, code int) bool
- func IsArangoErrorWithErrorNum(err error, errorNum ...int) bool
- func IsCanceled(err error) bool
- func IsConflict(err error) bool
- func IsEOF(err error) bool
- func IsExternalStorageError(err error) bool
- func IsForbidden(err error) bool
- func IsInvalidArgument(err error) bool
- func IsInvalidRequest(err error) bool
- func IsNoLeader(err error) bool
- func IsNoLeaderOrOngoing(err error) bool
- func IsNoMoreDocuments(err error) bool
- func IsNotFound(err error) bool
- func IsOperationTimeout(err error) bool
- func IsPreconditionFailed(err error) bool
- func IsResponse(err error) bool
- func IsTimeout(err error) bool
- func IsUnauthorized(err error) bool
- type ArangoError
- type ErrorSlice
- type InvalidArgumentError
- type NoMoreDocumentsError
- type Response
- type ResponseError
- type ResponseStruct
- type ResponseStructList
Constants ¶
const ( // general errors ErrNotImplemented = 9 ErrForbidden = 11 ErrDisabled = 36 // HTTP error status codes ErrHttpForbidden = 403 ErrHttpInternal = 501 // Internal ArangoDB storage errors ErrArangoReadOnly = 1004 // External ArangoDB storage errors ErrArangoCorruptedDatafile = 1100 ErrArangoIllegalParameterFile = 1101 ErrArangoCorruptedCollection = 1102 ErrArangoFileSystemFull = 1104 ErrArangoDataDirLocked = 1107 // General ArangoDB storage errors ErrArangoConflict = 1200 ErrArangoDocumentNotFound = 1202 ErrArangoDataSourceNotFound = 1203 ErrArangoIllegalName = 1208 ErrArangoUniqueConstraintViolated = 1210 ErrArangoDatabaseNotFound = 1228 ErrArangoDatabaseNameInvalid = 1229 // ArangoDB cluster errors ErrClusterReplicationWriteConcernNotFulfilled = 1429 ErrClusterLeadershipChallengeOngoing = 1495 ErrClusterNotLeader = 1496 // User management errors ErrUserDuplicate = 1702 )
Variables ¶
This section is empty.
Functions ¶
func IsArangoErrorWithCode ¶
IsArangoErrorWithCode returns true when the given error is an ArangoError and its Code field is equal to the given code.
func IsArangoErrorWithErrorNum ¶
IsArangoErrorWithErrorNum returns true when the given error is an ArangoError and its ErrorNum field is equal to one of the given numbers.
func IsCanceled ¶
IsCanceled returns true if the given error is the result on a cancelled context.
func IsConflict ¶
IsConflict returns true if the given error is an ArangoError with code 409, indicating a conflict.
func IsExternalStorageError ¶
IsExternalStorageError returns true if ArangoDB is having an error with accessing or writing to storage.
func IsForbidden ¶
IsForbidden returns true if the given error is an ArangoError with code 403, indicating a forbidden request.
func IsInvalidArgument ¶
IsInvalidArgument returns true if the given error is an InvalidArgumentError.
func IsInvalidRequest ¶
IsInvalidRequest returns true if the given error is an ArangoError with code 400, indicating an invalid request.
func IsNoLeader ¶
IsNoLeader returns true if the given error is an ArangoError with code 503 error number 1496.
func IsNoLeaderOrOngoing ¶
IsNoLeaderOrOngoing return true if the given error is an ArangoError with code 503 and error number 1496 or 1495
func IsNoMoreDocuments ¶
IsNoMoreDocuments returns true if the given error is an NoMoreDocumentsError.
func IsNotFound ¶
IsNotFound returns true if the given error is an ArangoError with code 404, indicating a object not found.
func IsOperationTimeout ¶
IsOperationTimeout returns true if the given error is an ArangoError with code 412, indicating a Operation timeout error
func IsPreconditionFailed ¶
IsPreconditionFailed returns true if the given error is an ArangoError with code 412, indicating a failed precondition.
func IsResponse ¶
IsResponse returns true if the given error is (or is caused by) a ResponseError.
func IsTimeout ¶
IsTimeout returns true if the given error is the result on a deadline that has been exceeded.
func IsUnauthorized ¶
IsUnauthorized returns true if the given error is an ArangoError with code 401, indicating an unauthorized request.
Types ¶
type ArangoError ¶
type ArangoError struct { HasError bool `json:"error"` Code int `json:"code"` ErrorNum int `json:"errorNum"` ErrorMessage string `json:"errorMessage"` }
ArangoError is a Go error with arangodb specific error information.
func IsArangoError ¶
func IsArangoError(err error) (bool, ArangoError)
IsArangoError returns true when the given error is an ArangoError
func (ArangoError) Error ¶
func (ae ArangoError) Error() string
Error returns the error message of an ArangoError.
func (ArangoError) Temporary ¶
func (ae ArangoError) Temporary() bool
Temporary returns true when the given error is a temporary error.
func (ArangoError) Timeout ¶
func (ae ArangoError) Timeout() bool
Timeout returns true when the given error is a timeout error.
type ErrorSlice ¶
type ErrorSlice []error
ErrorSlice is a slice of errors
func (ErrorSlice) FirstNonNil ¶
func (l ErrorSlice) FirstNonNil() error
FirstNonNil returns the first error in the slice that is not nil. If all errors in the slice are nil, nil is returned.
type InvalidArgumentError ¶
type InvalidArgumentError struct {
Message string
}
InvalidArgumentError is returned when a go function argument is invalid.
func (InvalidArgumentError) Error ¶
func (e InvalidArgumentError) Error() string
Error implements the error interface for InvalidArgumentError.
type NoMoreDocumentsError ¶
type NoMoreDocumentsError struct{}
NoMoreDocumentsError is returned by Cursor's, when an attempt is made to read documents when there are no more.
func (NoMoreDocumentsError) Error ¶
func (e NoMoreDocumentsError) Error() string
Error implements the error interface for NoMoreDocumentsError.
type Response ¶
type Response struct {
ResponseStruct `json:",inline"`
}
func (Response) GetErrorMessage ¶
func (Response) GetErrorNum ¶
type ResponseError ¶
type ResponseError struct {
Err error
}
A ResponseError is returned when a request was completely written to a server, but the server did not respond, or some kind of network error occurred during the response.
func (*ResponseError) Error ¶
func (e *ResponseError) Error() string
Error returns the Error() result of the underlying error.
type ResponseStruct ¶
type ResponseStruct struct { Error *bool `json:"error,omitempty"` Code *int `json:"code,omitempty"` ErrorMessage *string `json:"errorMessage,omitempty"` ErrorNum *int `json:"errorNum,omitempty"` }
func NewResponseStruct ¶
func NewResponseStruct() *ResponseStruct
func (ResponseStruct) AsArangoError ¶
func (r ResponseStruct) AsArangoError() ArangoError
func (*ResponseStruct) AsArangoErrorWithCode ¶
func (r *ResponseStruct) AsArangoErrorWithCode(code int) ArangoError
func (ResponseStruct) ExpectCode ¶
func (r ResponseStruct) ExpectCode(codes ...int) error
func (ResponseStruct) String ¶
func (r ResponseStruct) String() string
type ResponseStructList ¶
type ResponseStructList []ResponseStruct
func (ResponseStructList) HasError ¶
func (r ResponseStructList) HasError() bool