summaryrefslogtreecommitdiff
path: root/errors.go
diff options
context:
space:
mode:
Diffstat (limited to 'errors.go')
-rw-r--r--errors.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/errors.go b/errors.go
new file mode 100644
index 0000000..5c1802e
--- /dev/null
+++ b/errors.go
@@ -0,0 +1,22 @@
+package s3
+
+import (
+ "github.com/minio/minio-go/v7"
+ "github.com/spf13/afero"
+)
+
+func fromErrorResponse(err error) error {
+ resp, ok := err.(minio.ErrorResponse)
+ if !ok {
+ return err
+ }
+
+ switch resp.Code {
+ case "NoSuchKey":
+ return afero.ErrFileNotFound
+ case "EntityTooLarge":
+ return afero.ErrTooLarge
+ }
+
+ return err
+}