From d38375a08ca0c647a57802d39a822a26fb0435de Mon Sep 17 00:00:00 2001 From: n1474335 Date: Thu, 4 Jan 2018 14:43:49 +0000 Subject: [PATCH] Improved error handling for file uploads --- src/web/InputWaiter.js | 4 ++++ src/web/LoaderWorker.js | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/web/InputWaiter.js b/src/web/InputWaiter.js index 33784edc..e39e06fd 100755 --- a/src/web/InputWaiter.js +++ b/src/web/InputWaiter.js @@ -214,6 +214,10 @@ InputWaiter.prototype.handleLoaderMessage = function(e) { fileLoaded.textContent = r.progress + "%"; } + if (r.hasOwnProperty("error")) { + this.app.alert(r.error, "danger", 10000); + } + if (r.hasOwnProperty("fileBuffer")) { log.debug("Input file loaded"); this.fileBuffer = r.fileBuffer; diff --git a/src/web/LoaderWorker.js b/src/web/LoaderWorker.js index 2da381ed..bcb68829 100644 --- a/src/web/LoaderWorker.js +++ b/src/web/LoaderWorker.js @@ -46,5 +46,9 @@ self.loadFile = function(file) { seek(); }; + reader.onerror = function(e) { + self.postMessage({"error": file.error.message}); + }; + seek(); };