Files
Hermes Agent ed23524817 fix: harden Claro diagnostics and runtime guards
Preserve source locations, validate malformed JSON, and add opt-in resource limits. Include executable error-guide coverage, learner pilot materials, native Windows acceptance helpers, and updated CI/documentation.
2026-10-25 02:42:53 +00:00

2.1 KiB

Errors and small repairs

An error starts with filename:line:. Open that file and find that line. The line belongs to the function or imported file where the error happened, not automatically to the caller. Caught errors expose the same origin through LASTERRORFILE and LASTERRORLINE.

Use claro check my_program.claro for command/block mistakes; running the program also detects runtime expression/value errors. A checker is not a sandbox. The examples below are executed by tools/validate_error_guide.py.

Quote

Save as quote.claro. Run claro quote.claro.

SAY "Start"
SAY "unfinished

Message:

quote.claro:2: Text is missing a closing quote. Add a double quote at the end.

One repair:

SAY "Start"
SAY "finished"

Operand

Save as operand.claro. Run claro operand.claro.

SET score 1
SAY score +

Message:

operand.claro:2: This expression needs a value after the operator.

One repair:

SET score 1
SAY score + 1

Command

Save as command.claro. Run claro check command.claro.

PRNT "Hello"

Message:

command.claro:1: I do not know the command "PRNT". Did you mean "SAY"?

One repair:

SAY "Hello"

Assignment

Save as assignment.claro. Run claro check assignment.claro.

SET name

Message:

assignment.claro:1: SET needs a name and a value. Try: SET name "Alex"

One repair:

SET name "Alex"
SAY name

Choice

Save as choice.claro. Run claro check choice.claro.

IF YES
    SAY "Yes"

Message:

choice.claro:1: IF block opened here needs END

One repair:

IF YES
    SAY "Yes"
END

Variable

Save as variable.claro. Run claro variable.claro.

SET score 10
SAY socre

Message:

variable.claro:2: I do not know the variable "socre" yet.

One repair:

SET score 10
SAY score

These teach short SET and END. Older forms remain supported in compatibility syntax, not required as repairs. For a caught error, read its metadata before another error changes it.