good morning!!!!

Skip to content
Snippets Groups Projects
Unverified Commit f21fd265 authored by Nikita Vaniasin's avatar Nikita Vaniasin Committed by GitHub
Browse files

Add IsExternalStorageError to check for external storage errors. (#458)

parent a4dd5c00
Branches
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@
## [master](https://github.com/arangodb/go-driver/tree/master) (N/A)
- Use Go 1.19.4
- Add `IsExternalStorageError` to check for [external storage errors](https://www.arangodb.com/docs/stable/appendix-error-codes.html#external-arangodb-storage-errors).
## [1.4.1](https://github.com/arangodb/go-driver/tree/v1.4.1) (2022-12-14)
- Add support for `checksum` in Collections
......
......@@ -44,6 +44,13 @@ const (
// 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
......@@ -167,6 +174,18 @@ func IsDataSourceOrDocumentNotFound(err error) bool {
IsArangoErrorWithErrorNum(err, ErrArangoDocumentNotFound, ErrArangoDataSourceNotFound)
}
// IsExternalStorageError returns true if ArangoDB is having an error with accessing or writing to storage.
func IsExternalStorageError(err error) bool {
return IsArangoErrorWithErrorNum(
err,
ErrArangoCorruptedDatafile,
ErrArangoIllegalParameterFile,
ErrArangoCorruptedCollection,
ErrArangoFileSystemFull,
ErrArangoDataDirLocked,
)
}
// IsConflict returns true if the given error is an ArangoError with code 409, indicating a conflict.
func IsConflict(err error) bool {
return IsArangoErrorWithCode(err, http.StatusConflict) || IsArangoErrorWithErrorNum(err, ErrUserDuplicate)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment