Uncaught undefined after 2v20?

Posted on
  • I'm not sure if I should log this or if it's just me (or if it's already logged and I'm just not seeing it):

    After firmware version 2v20, if you make a settings change like switching from light to dark theme and back out, when BangleJS 2 reloads, an "Uncaught undefined" exception shows up at the end of the log.

    I went backward in firmware versions until it went away and found:
    2v19 - After reboot, no errors in the log
    2v20 through 2v21.31 - After reboot an Uncaught undefined shows in the log

    I uninstalled all apps except "Simplest Clock", "Settings", and "Bootloader" while testing. Wasn't sure how to debug it further, since it seems to be happening during an event or something after boot.

  • I see it too on 2v21, but everything seems to work as expected. Maybe @Gordon has an idea where this comes from.

    My applications are up to date.

  • I also often (maybe always, not sure) get an Uncaught undefined that seems inconsequential.

  • Actually, I just noticed it's probably causing disconnects from the Web IDE Remote connection. I'll send log to @Gordon in a message.

  • Thanks for checking on this - I don't think this is anything to worry about too much - I believe it comes from this line which in the past would have thrown Storage Updated: https://github.com/espruino/BangleApps/blob/master/apps/boot/bootupdate.js#L22C2-L22C90

    It's a bit of a hack to ensure that if the settings are changes, at boot time no extra code gets run (because there was an exception) and the Bangle can then reload the new settings.

    @thinkpoop on 2v19 did you see a Storage Updated message when changing? It's possible something has got broken with the reporting of exceptions (maybe after a reload).

  • I could've sworn I've seen "Storage Updated" in the past, but trying 2v19 and even 2v18 now, it isn't showing up.

    But if I go back to 2v21 and temporarily remove the hash check by updating bootupdate.js, the exception does go away.

    That would explain why it's only during settings updates. And why when I tried to manually remove the hash check in .boot0 to put in a try/catch, I wasn't catching anything... I thought I was fighting against the bootupdate.js rewriting it, but I had also removed the exception.

    It hasn't been an issue, besides a lot of head scratching and thinking I broke something.

    Thanks!

  • I think I was wrong to write this off - while the Uncaught undefined itself is ok, I just flashed a version onto a device and did a Factory Reset, and I found it happened when loading every new app. Was this what you were seeing?

    I believe the issue has been that the pretokeniser was pretokenising empty strings when it shouldn't have, and this caused an error - which wasn't reported properly because it was inside bootupdate.js. Once you update bootupdate.js manually it's fixed.

    It seems the alarm app may have been broken by default anyway. I've just fixed the ide and the app loader, as well as the factory update image in cutting edge builds. Luckily I'm not sure how but it seems that 2v21 (including the factory image) escaped ok

  • I only noticed it when doing an update to setting.json, which would trigger that hash check exception. It looks like any new *.boot.js file would do it too though.

    I just updated to 2v21.69, updated sched/alarms/locale, and forced bootloader to update (all from the development app loader).

    The uncaught undefined still happens. Always after all of the console logs from booting.

    I still haven't noticed any functionality issues from it (I don't use the web ide remote connection though).

  • The uncaught undefined still happens.

    They have disappeared for me after updating to fw 2v21.69 and reinstalling all apps from the More... tab.

  • Tried reinstalling all apps and uninstalling any custom things, then tried again with pretokenization unchecked in the app loader. Still get the exception.

    I could just be overlooking something.

     ____                 _
    |  __|___ ___ ___ _ _|_|___ ___
    |  __|_ -| . |  _| | | |   | . |
    |____|___|  _|_| |___|_|_|_|___|
             |_| espruino.com
     2v21.69 (c) 2024 G.Williams
    Uncaught undefined
    >
    

    Quick code to recreate it in the IDE (toggling quiet mode on/off):

    let s = require('Storage').readJSON('setting.json');
    s.quiet = s.quiet==1?0:1;
    require('Storage').writeJSON('setting.json',s);
    Bangle.showClock();
    
  • Well, as I say the Uncaught undefined itself is ok. It should update when the settings change.

    ... but only once. I was finding that on the latest builds with factory firmware, it was printing Uncaught undefined every time you changed app!

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Uncaught undefined after 2v20?

Posted by Avatar for thinkpoop @thinkpoop

Actions