Skip to content

Commit

Permalink
core: Only catch errors from onBeforeFileAdded
Browse files Browse the repository at this point in the history
62c2645, but for `onBeforeFileAdded`.
  • Loading branch information
goto-bus-stop committed Jul 9, 2017
1 parent 62c2645 commit b763e15
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/core/Core.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,10 @@ class Uppy {
}

addFile (file) {
return this.opts.onBeforeFileAdded(file, this.getState().files).then(() => {
return this.opts.onBeforeFileAdded(file, this.getState().files).catch((err) => {
this.emit('informer', err, 'error', 5000)
return Promise.reject(`onBeforeFileAdded: ${err}`)
}).then(() => {
return Utils.getFileType(file).then((fileType) => {
const updatedFiles = Object.assign({}, this.state.files)
const fileName = file.name || 'noname'
Expand Down Expand Up @@ -288,10 +291,6 @@ class Uppy {
}
})
})
.catch((err) => {
this.emit('informer', err, 'error', 5000)
return Promise.reject(`onBeforeFileAdded: ${err}`)
})
}

removeFile (fileID) {
Expand Down

0 comments on commit b763e15

Please sign in to comment.