mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-25 03:08:34 +00:00
core: Prevent unhandled rejection warnings in addFile()
This commit is contained in:
parent
5537bf4038
commit
26cafb1afe
1 changed files with 7 additions and 1 deletions
|
|
@ -389,7 +389,13 @@ class Uppy {
|
|||
.catch((err) => {
|
||||
const message = typeof err === 'object' ? err.message : err
|
||||
this.info(message, 'error', 5000)
|
||||
return Promise.reject(typeof err === 'object' ? err : new Error(err))
|
||||
const rejected = Promise.reject(typeof err === 'object' ? err : new Error(err))
|
||||
// Silence the unhandled rejection; we have already shown it to the user,
|
||||
// so the consumer may not need to do anything with this result.
|
||||
// Note that the result is still a rejected Promise, it will just not
|
||||
// trigger unhandled rejection warnings in the browser console.
|
||||
rejected.catch(() => {})
|
||||
return rejected
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue