drained: handle errors from bootupdate

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'));
                                             ^
```
pull/2684/head
Rob Pilling 2023-04-19 18:36:03 +01:00
parent 73d41a40ff
commit f8fc93301e
1 changed files with 5 additions and 1 deletions

View File

@ -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
}