Errors

There are two types of errors: parse-time, and run-time.

Parse-time errors are typically syntax errors due to a malformed script (for example, missing an 'end' or having mismatched ()’s). If a parse error occurs, the script is not executed at all. Only the first parse-time error is reported.

Run-time errors occur during the evaluation of a properly formed script. These are typically due to passing incompatible data objects into an operator or function, attempting to use an undefined function or variable, or attempting to create an object that is too large to fit in memory. In the case of a run-time error, the script IS evaluated up until the point of the error. If the offending code is in a try block, then the script may be able to recover and continue (as mentioned in the Try/Catch section).

In the case of a run-time error, any variables created in the global scope before the error will still exist. However, if a run-time error occurs in a function (and is not caught), all function scopes are closed and all variables local to those functions are erased.

In either case, an error message indicating the reason for the error, file, line number, and approximate character position is issued. For parse-time errors, the reason is always “syntax error.”

Errors are output in red in the console (unless in console mode).

Example

error('this is an error') will output:
Error: this is an error