How to test for Error status

Question

How should you test for error status

Answer

The following two tips were found on Peg, sent there by George Potempkin:

1. Check ERROR-STATUS:NUM-MESSAGES instead of ERROR-STATUS:ERROR.

2. Check the error stack directly:

ASSIGN _MSG = 0. /* only V9 - put a "message" in error stack */
RUN something.
IF _MSG(1) NE 0 THEN