Browse Source

s3: Use AWS-returned error message

Renée Kooi 7 years ago
parent
commit
515902d836
1 changed files with 8 additions and 0 deletions
  1. 8 0
      src/plugins/AwsS3/index.js

+ 8 - 0
src/plugins/AwsS3/index.js

@@ -66,6 +66,14 @@ module.exports = class AwsS3 extends Plugin {
             key: getValue('Key'),
             etag: getValue('ETag')
           }
+        },
+        getResponseError (xhr) {
+          // If no response, we don't have a specific error message, use the default.
+          if (!xhr.responseXML) {
+            return
+          }
+          const error = xhr.responseXML.querySelector('Error > Message')
+          return new Error(error.textContent)
         }
       })
     })