good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
Go Driver
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
github
arangodb
Go Driver
Commits
f21fd265
Unverified
Commit
f21fd265
authored
Dec 21, 2022
by
Nikita Vaniasin
Committed by
GitHub
Dec 21, 2022
Browse files
Options
Downloads
Patches
Plain Diff
Add IsExternalStorageError to check for external storage errors. (#458)
parent
a4dd5c00
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGELOG.md
+1
-0
1 addition, 0 deletions
CHANGELOG.md
error.go
+19
-0
19 additions, 0 deletions
error.go
with
20 additions
and
0 deletions
CHANGELOG.md
+
1
−
0
View file @
f21fd265
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
error.go
+
19
−
0
View file @
f21fd265
...
...
@@ -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
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment