Prolog Language Error handling and exceptions General points about error handling


Prolog features exceptions, which are part of the Prolog ISO standard.

An exception can be thrown with throw/1, and caught with catch/3.

The ISO standard defines many cases in which errors must or may be thrown. The standardized exceptions are all of the form error(E,_), where E indicates the error. Examples are instantiation_error, domain_error and type_error, which see.

An important predicate in connection with exceptions is setup_call_cleanup/3, which see.