Skip to contentSkip to Content
Language guideError handling

Error handling

Errors are unavoidable when writing code, but they help create running code. The Karvi Studio has excellent error handling which can be used to debug and create an effectively working payload:

hello.mantis
1error[ERR_UNKNOWN_KEY]: Unknown or unsupported key
2 --> line 4
3 |
44 | CTRL SHFIT ESCAPE
5 | ^^^^^^^^^^^^
6 |
7 = help: This key is not recognized by the device.
8 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.
Warning:

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

Last updated on