errmod
The errmod command chooses whether James stops at the first error or reports them all, and whether it prints warnings.
Syntax
errmod <mode>
mode is an integer, 0, 1, 2 or 3. James reads it as two choices, set out under the rules below.
What it does
James applies the mode to every diagnostic from then on, until another errmod. A script that never says errmod runs in mode 0: it reports every error and every warning.
When James applies it
When it is read, for every diagnostic raised after it. It is legal in any phase: Control, Part or Merge.
Rules James adds
- The four modes are two independent choices. An even mode shows warnings and an odd mode suppresses them. A mode of 0 or 1 reports every error and goes on, and a mode of 2 or 3 stops at the first error.
- Modes 2 and 3 abort. James has no interactive mode to drop into.
- With two errors and a warning in the script, mode 0 reports all three, mode 1 reports both errors and no warning, and modes 2 and 3 report the first error only.
- A missing mode is E0218 reported at the
errmodkeyword, withgot end of inputorgot the end of the line.
Diagnostics
- E0218: the mode is not 0, 1, 2 or 3, or is missing.
Example
The script tests/corpus/110-session-commands-inert/input.tg, which make test runs:
errmod 0
echo hello world
becho beep and text
caption cap Test Caption
block 1 2;1 2;1 2;0 1;0 1;0 1;
endpart
Line 1 sets mode 0, the default, so the script reports everything. The script has nothing to report, and the IR holds one part.
See also
- Diagnostics: how James prints an error and a warning.
- end: the other command that stops a script.