Cold Help System: Programming: ColdC Reference Manual: Language Structure: Expressions: Error Handling Expression


Two mechanisms exist for handling errors in expressions. These are the critical expression and the propagation expression. The critical expression is used to ignore any errors thrown from inside the expression. It has the following syntax:

(| expression |)

If an error occurs in expression the interpreter will stop evaluating expression and continue to execute the current method as if it had succeeded evaluating expression. The value of expression will be the error code for the error which occurred.

The propagation expression causes any error thrown by a method call within the expression to be thrown as if the current method threw it. It has the following syntax:

(> expression <)

If an error occurs in expression it will propagate to the calling method as if the error had originated in the calling method and not in the current method. Otherwise, the calling method will receive the error as ~methoderr.

Critical expressions override the behavior of catch statements so that errors which occur within critical expressions do not trigger catch error handlers. Propagation expressions do not override critical expressions or catch statements, however. They do not prevent errors from being caught; they only determine how errors propagate if they are not caught.

For more information on handling errors, see section Errors.


Data | Operators | Variable Expression | Function Call Expression | Method Call Expression | Error Handling Expression | Looping Expressions


the Cold Dark