← Back to Docs
Error Reporting
When VDX encounters an error in your code, it shows a clear message with the file name, line number, and surrounding source context.
What you see
Instead of a raw crash, VDX displays the error like this:
error: [VDX] Undefined variable 'z' at line 4
--> myfile.vdx:4
|
3 | let x = 10;
4 | print(z); <--
5 | print(x);
|What gets shown
- The error message with a
[VDX]prefix - The file name and line number
- The line before, the error line (marked with
<--), and the line after
Common errors
| Error | Cause |
|---|---|
| Undefined variable | Using a variable not declared with let |
| Undefined function | Calling a function that doesn't exist |
| Array index out of bounds | Accessing an index beyond the array size |
| Division by zero | Dividing an integer by 0 |
| Expected expression | Syntax error — unexpected token where an expression was expected |
| Loop safety | A while loop iterating too fast without @unsafe |