microbit-foundation / python-editor-v3

Micro:bit Educational Foundation Python Editor V3
https://python.microbit.org
MIT License
56 stars 37 forks source link

Python file named .hex silently fails to open #1042

Closed microbit-matt-hillsdon closed 1 year ago

microbit-matt-hillsdon commented 1 year ago

Seen in the wild via logging.

Production stacktrace:

Uncaught (in promise) Error: Record does not start with a ":": from microbit import *
    at validateRecord (ihex.ts:125:1)
    at Module.getRecordType (ihex.ts:136:1)
    at isMakeCodeForV1HexRecords (universal-hex.ts:342:1)
    at isMakeCodeForV1Hex (universal-hex.ts:359:1)
    at ProjectActions.load (project-actions.tsx:308:1)
microbit-matt-hillsdon commented 1 year ago

Ah, this is in the isMakeCodeForV1Hex check that we already do in an error handling path so it doesn't get error handling itself when it fails. It just needs to swallow the error.