javascript: make DirectUpload errors return true error objects

DirectUpload errors are string (instead of error objects). But Sentry
works better if we have true errors, which include the stacktrace.
This commit is contained in:
Pierre de La Morinerie 2020-04-09 12:50:47 +02:00
parent 1c0fecc3ce
commit bc1c15b81d

View file

@ -15,10 +15,10 @@ export default class Uploader {
this.progressBar.start();
return new Promise((resolve, reject) => {
this.directUpload.create((error, attributes) => {
if (error) {
this.progressBar.error(error);
reject(error);
this.directUpload.create((errorMsg, attributes) => {
if (errorMsg) {
this.progressBar.error(errorMsg);
reject(new Error(errorMsg));
} else {
resolve(attributes.signed_id);
}