Author(s): The CLIP Group.
Version: 1.10#7 (2006/4/26, 19:22:13 CEST)
Version of last change: 1.9#344 (2004/4/29, 12:56:34 CEST)
This module includes predicates related to exceptions, which alter the normal flow of Prolog.
exceptions
)exceptions
)
catch(Goal, Error, Handler)
Executes Goal
. If an exception is raised during its execution, Error
is unified with the exception, and if the unification succeeds, the entire execution derived from Goal
is aborted, and Handler
is executed. The execution resumes with the continuation of the catch/3 call. For example, given the code
p(X) :- throw(error), display('---'). p(X) :- display(X).
the execution of "catch(p(0), E, display(E)), display(.), fail.
" results in the output "error.
".
Meta-predicate with arguments: catch(goal,?,goal)
.
Usage: catch(+callable, ?term, +callable)
* ISO *
basic_props:native/1
)
intercept(Goal, Error, Handler)
Executes Goal
. If an exception is raised during its execution, Error
is unified with the exception, and if the unification succeeds, Handler
is executed and then the execution resumes after the predicate which produced the exception. Note the difference with builtin
catch/3
, given the same code defined there, the execution of "intercept(p(0), E, display(E)), display(.), fail.
" results in the output "error---.0.
".
Meta-predicate with arguments: intercept(goal,?,goal)
.
throw(Ball)
Raises an error, throwing the exception Ball
, to be caught by an ancestor
catch/3
or
intercept/3
. The closest matching ancestor is chosen. Exceptions are also thrown by other builtins in case of error.
Usage: * ISO *
Ball
is currently a term which is not a free variable.
(term_typing:nonvar/1
)
halt(halt
Halt the system, exiting to the invoking shell.
Usage: * ISO *
basic_props:native/1
)
halt(Code)
Halt the system, exiting to the invoking shell, returning exit code Code
.
abort(abort
Abort the current execution.
Go to the first, previous, next, last section, table of contents.