summaryrefslogtreecommitdiff
path: root/vendor/codeberg.org/gruf/go-storage/s3/errors.go
diff options
context:
space:
mode:
authorLibravatar Terin Stock <terinjokes@gmail.com>2025-03-09 17:47:56 +0100
committerLibravatar Terin Stock <terinjokes@gmail.com>2025-12-01 22:08:04 +0100
commitb1af8fd87760b34e3ff2fd3bda38f211815a0473 (patch)
tree9317fad1a7ec298d7a8d2678e4e422953bbc6f33 /vendor/codeberg.org/gruf/go-storage/s3/errors.go
parent[chore] update URLs to forked source (diff)
downloadgotosocial-b1af8fd87760b34e3ff2fd3bda38f211815a0473.tar.xz
[chore] remove vendor
Diffstat (limited to 'vendor/codeberg.org/gruf/go-storage/s3/errors.go')
-rw-r--r--vendor/codeberg.org/gruf/go-storage/s3/errors.go52
1 files changed, 0 insertions, 52 deletions
diff --git a/vendor/codeberg.org/gruf/go-storage/s3/errors.go b/vendor/codeberg.org/gruf/go-storage/s3/errors.go
deleted file mode 100644
index 0b2d3be62..000000000
--- a/vendor/codeberg.org/gruf/go-storage/s3/errors.go
+++ /dev/null
@@ -1,52 +0,0 @@
-package s3
-
-import (
- "strings"
-
- "codeberg.org/gruf/go-storage"
- "codeberg.org/gruf/go-storage/internal"
- "github.com/minio/minio-go/v7"
-)
-
-// CachedErrorResponse can be returned
-// when an S3 is configured with caching,
-// and the basic details of an error
-// response have been stored in the cache.
-type CachedErrorResponse struct {
- Code string
- Key string
-}
-
-func (err *CachedErrorResponse) Error() string {
- return "cached '" + err.Code + "' response for key:" + err.Key
-}
-
-func (err *CachedErrorResponse) Is(other error) bool {
- switch other {
- case storage.ErrNotFound:
- return err.Code == "NoSuchKey"
- case storage.ErrAlreadyExists:
- return err.Code == "Conflict"
- default:
- return false
- }
-}
-
-func isNotFoundError(err error) bool {
- errRsp, ok := err.(minio.ErrorResponse)
- return ok && errRsp.Code == "NoSuchKey"
-}
-
-func isConflictError(err error) bool {
- errRsp, ok := err.(minio.ErrorResponse)
- return ok && errRsp.Code == "Conflict"
-}
-
-func isObjectNameError(err error) bool {
- return strings.HasPrefix(err.Error(), "Object name ")
-}
-
-func cachedNotFoundError(key string) error {
- err := CachedErrorResponse{Code: "NoSuchKey", Key: key}
- return internal.WrapErr(&err, storage.ErrNotFound)
-}