diff options
Diffstat (limited to 'vendor/codeberg.org/gruf/go-storage/s3/errors.go')
| -rw-r--r-- | vendor/codeberg.org/gruf/go-storage/s3/errors.go | 52 |
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) -} |
