← 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

ErrorCause
Undefined variableUsing a variable not declared with let
Undefined functionCalling a function that doesn't exist
Array index out of boundsAccessing an index beyond the array size
Division by zeroDividing an integer by 0
Expected expressionSyntax error — unexpected token where an expression was expected
Loop safetyA while loop iterating too fast without @unsafe