Prechádzať zdrojové kódy

Added fix to restore UI

Andrew Chalkley 9 rokov pred
rodič
commit
04ffeadefb
1 zmenil súbory, kde vykonal 9 pridanie a 5 odobranie
  1. 9 5
      front-end/js/app.js

+ 9 - 5
front-end/js/app.js

@@ -176,7 +176,11 @@ function updateProgressUI(percent, display) {
 function flashWithManifest(manifest) {
     appStatus.textContent = `Flashing ${portsSelect.value}`;
     prepareBinaries(manifest)
-    .on("error", onError)
+    .on("error", err => {
+        isFlashing = false;
+        onError(err);
+        restoreUI();
+    })
     .on("progress", progress => {
         //For the download/extract progress.
         updateProgressUI(progress.details.downloadedBytes / progress.details.downloadSize, progress.display);
@@ -202,11 +206,11 @@ function flashWithManifest(manifest) {
                     restoreUI();
                     log.info("Flashed to latest Espruino build!", result);
                 });
-        }).catch(error => {
-            esp.close();
-            new Notification("An error occured during flashing.");
+        }).catch(err => {
             isFlashing = false;
-            log.error("Oh noes!", error);
+            esp.close();
+            log.error("Oh noes!", err);
+            onError(err);
             restoreUI();
         });
     });