Browse Source

s3: Emit upload-error when generating upload parameters fails.

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

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

@@ -60,12 +60,18 @@ module.exports = class AwsS3 extends Plugin {
             value: 1
             value: 1
           })
           })
           return params
           return params
+        }).catch((error) => {
+          this.core.emit('core:upload-error', file.id, error)
         })
         })
       })
       })
     ).then((responses) => {
     ).then((responses) => {
       const updatedFiles = {}
       const updatedFiles = {}
       fileIDs.forEach((id, index) => {
       fileIDs.forEach((id, index) => {
         const file = this.core.getFile(id)
         const file = this.core.getFile(id)
+        if (file.error) {
+          return
+        }
+
         const {
         const {
           method = 'post',
           method = 'post',
           url,
           url,