From b7d1146960a81b15293b910fdf1179699205d567 Mon Sep 17 00:00:00 2001 From: liamcottle Date: Sun, 14 Jul 2024 19:40:46 +1200 Subject: [PATCH] show flashing errors --- index.html | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/index.html b/index.html index 6575c29..0698a1c 100644 --- a/index.html +++ b/index.html @@ -112,17 +112,25 @@ return; } - // flash file + // update progress this.isFlashing = true; this.progress = 0; - const flasher = new Nrf52DfuFlasher(serialPort); - await flasher.flash(file, (percentage) => { - this.progress = percentage; - if(this.progress === 100){ - this.isFlashing = false; - alert("Firmware has been flashed!"); - } - }); + + // flash file + try { + const flasher = new Nrf52DfuFlasher(serialPort); + await flasher.flash(file, (percentage) => { + this.progress = percentage; + if(this.progress === 100){ + this.isFlashing = false; + alert("Firmware has been flashed!"); + } + }); + } catch(e) { + this.isFlashing = false; + alert("Firmware flashing failed: " + e); + console.log(e); + } }, async detect() {