ROUTINE-LEVEL ON ERROR UNDO, THROW statement

Use this statement in a procedure (.p) or class (.cls) file to change the implicit, default ON ERROR directive from UNDO, RETRY to UNDO, THROW for all routine-level blocks in a file. The statement must come before any executable or DEFINE statements in a file. However, it can come either before or after a USING statement.

Syntax

ROUTINE-LEVEL ON ERROR UNDO, THROW.

The following blocks are the routine-level blocks affected by this statement:

This statement does not affect:

Note these alternatives to the ROUTINE-LEVEL ON ERROR UNDO, THROW statement:

Example

This code propagates an error from an internal procedures up to the main procedure block.

r-ROUTINE-LEVEL-01.p

ROUTINE-LEVEL ON ERROR UNDO, THROW.

PROCEDURE find1000:
  FIND FIRST Customer WHERE Customer.CustNum = 1000.
END PROCEDURE.

PROCEDURE find2000:
  FIND FIRST Customer WHERE Customer.CustNum = 2000.
END PROCEDURE.

PROCEDURE find3000:
  FIND FIRST Customer WHERE Customer.CustNum = 3000.
END PROCEDURE.

/* Main Block */
RUN find1000.
RUN find2000.
RUN find3000.

CATCH eAnyError AS Progress.Lang.SysError:
  MESSAGE "Your CATCH block associated with the the main block (.p) has handled an error in an internal procedure."
    VIEW-AS ALERT-BOX BUTTONS OK.
END CATCH.

Notes

See also

BLOCK-LEVEL ON ERROR UNDO, THROW statement, ON ENDKEY phrase, ON ERROR phrase, ON QUIT phrase, RETURN statement, RETURN-VALUE function, STOP statement, UNDO-THROW-SCOPE attribute