From f8fc93301e78f614382757e3f8c2e5cbbe0f6950 Mon Sep 17 00:00:00 2001 From: Rob Pilling Date: Wed, 19 Apr 2023 18:36:03 +0100 Subject: [PATCH] drained: handle errors from bootupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Such as: ``` Uncaught ReferenceError: "bleServiceOptions" is not defined  at line 4 col 228 in .boot0 ...ECwA=="));bleServiceOptions.hid=Bangle.HID;                               ^ at line 68 col 50 in drained.app.js eval(require('Storage').read('bootupdate.js'));                                              ^ ``` --- apps/drained/app.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/drained/app.ts b/apps/drained/app.ts index af97454a4..9fc2665ee 100644 --- a/apps/drained/app.ts +++ b/apps/drained/app.ts @@ -103,7 +103,11 @@ const { disableBoot = false, restore = 20 }: DrainedSettings // re-enable normal boot code when we're above a threshold: function drainedRestore() { // "public", to allow users to call if(disableBoot){ - eval(require('Storage').read('bootupdate.js')); + try{ + eval(require('Storage').read('bootupdate.js')); + }catch(e){ + console.log("error restoring bootupdate:" + e); + } } load(); // necessary after updating boot.0 }