shared

package
v2.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 27, 2024 License: Apache-2.0 Imports: 5 Imported by: 16

Documentation

Index

Constants

View Source
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

func IsArangoErrorWithCode(err error, code int) bool

IsArangoErrorWithCode returns true when the given error is an ArangoError and its Code field is equal to the given code.

func IsArangoErrorWithErrorNum

func IsArangoErrorWithErrorNum(err error, errorNum ...int) bool

IsArangoErrorWithErrorNum returns true when the given error is an ArangoError and its ErrorNum field is equal to one of the given numbers.

func IsCanceled

func IsCanceled(err error) bool

IsCanceled returns true if the given error is the result on a cancelled context.

func IsConflict

func IsConflict(err error) bool

IsConflict returns true if the given error is an ArangoError with code 409, indicating a conflict.

func IsEOF

func IsEOF(err error) bool

func IsExternalStorageError

func IsExternalStorageError(err error) bool

IsExternalStorageError returns true if ArangoDB is having an error with accessing or writing to storage.

func IsForbidden

func IsForbidden(err error) bool

IsForbidden returns true if the given error is an ArangoError with code 403, indicating a forbidden request.

func IsInvalidArgument

func IsInvalidArgument(err error) bool

IsInvalidArgument returns true if the given error is an InvalidArgumentError.

func IsInvalidRequest

func IsInvalidRequest(err error) bool

IsInvalidRequest returns true if the given error is an ArangoError with code 400, indicating an invalid request.

func IsNoLeader

func IsNoLeader(err error) bool

IsNoLeader returns true if the given error is an ArangoError with code 503 error number 1496.

func IsNoLeaderOrOngoing

func IsNoLeaderOrOngoing(err error) bool

IsNoLeaderOrOngoing return true if the given error is an ArangoError with code 503 and error number 1496 or 1495

func IsNoMoreDocuments

func IsNoMoreDocuments(err error) bool

IsNoMoreDocuments returns true if the given error is an NoMoreDocumentsError.

func IsNotFound

func IsNotFound(err error) bool

IsNotFound returns true if the given error is an ArangoError with code 404, indicating a object not found.

func IsOperationTimeout

func IsOperationTimeout(err error) bool

IsOperationTimeout returns true if the given error is an ArangoError with code 412, indicating a Operation timeout error

func IsPreconditionFailed

func IsPreconditionFailed(err error) bool

IsPreconditionFailed returns true if the given error is an ArangoError with code 412, indicating a failed precondition.

func IsResponse

func IsResponse(err error) bool

IsResponse returns true if the given error is (or is caused by) a ResponseError.

func IsTimeout

func IsTimeout(err error) bool

IsTimeout returns true if the given error is the result on a deadline that has been exceeded.

func IsUnauthorized

func IsUnauthorized(err error) bool

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) GetCode

func (r Response) GetCode() int

func (Response) GetError

func (r Response) GetError() bool

func (Response) GetErrorMessage

func (r Response) GetErrorMessage() string

func (Response) GetErrorNum

func (r Response) GetErrorNum() int

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL