Skip to contentSkip to Content

Error handling

HDC’s error handling happens entirely at compile time — there’s no try/catch inside a script, because the device only ever executes bytecode that already passed every check on your computer. When something in a script is wrong, HiveFusion Studio’s console shows a compiler-style diagnostic instead of silently producing a broken payload:

error[ERR_UNKNOWN_KEY]: Unknown or unsupported key --> line 4 | 4 | CTRL SHFIT ESCAPE | ^^^^^^^^^^^^ | = help: This key is not recognized by the device. Make sure you are using a valid key name.

Every diagnostic follows the same shape: an error code and message, the line it happened on, the offending source with a caret pointing at it, and a help note explaining how to fix it. A few of the categories you’ll run into:

CategoryExample
Unknown tokenA misspelled or unsupported command.
Unknown / unsupported keyA key name the device doesn’t recognize.
Missing or invalid argumentDELAY with no number, or a non-numeric value where one is required.
Structural errorsAn unterminated STRING_BLOCK, FUNCTION or BUTTON_DEF; a stray END_ keyword with nothing open; a duplicate or nested block.
Function errorsCalling a function that was never defined, redefining one, or nesting definitions.

A compile error always stops the compile — nothing partially-correct is ever uploaded to the device.

Last updated on