Next: , Up: Errors   [Index]


10.1 Generating Errors

error

void error(text t);

The function ‘error’ will fail execution and will not return (the error may still be trapped). t will be included in the displayed error report.

The program:

o_text("1\n");
o_text("2\n");
error("bad luck");
o_text("3\n");

will stop after printing 2 and will display an error message reading:

<interpreter name>: <program name>: 3: bad luck