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 key2 --> line 43 |44 | CTRL SHFIT ESCAPE5 | ^^^^^^^^^^^^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:
| Category | Example |
|---|---|
| Unknown token | A misspelled or unsupported command. |
| Unknown / unsupported key | A key name the device doesn’t recognize. |
| Missing or invalid argument | DELAY with no number, or a non-numeric value where one is required. |
| Structural errors | An unterminated STRING_BLOCK, FUNCTION or BUTTON_DEF; a stray END_ keyword with nothing open; a duplicate or nested block. |
| Function errors | Calling 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