A start has been made to make exception handling available to the Prolog user. On exceptions a dynamic and multifile defined predicate exception/3 is called. If this user defined predicate succeeds Prolog assumes the exception has been taken care of. Otherwise the system default exception handler is called.
undefined_predicate
Context
is instantiated to a term Name/Arity. Name
refers to the name and Arity to the arity of the undefined
predicate. If the definition module of the predicate is not user, Context
will be of the form <Module>:<Name>/<Arity>.
If the predicate fails Prolog will print the default error warning and
start the tracer. If the predicate succeeds it should instantiate the
last argument either to the atom fail
to tell Prolog to
fail the predicate or the atom
retry
to tell Prolog to retry the predicate. This only
makes sense if the exception handler has defined the predicate.
Otherwise it will lead to a loop.
warning(<Path>, <LineNo>, <Message>)
,
where Path is the absolute filename of the file prolog is
reading; LineNo is an estimate of the line number where the
error occurred and Message is a Prolog string indicating the
message. The Action argument is ignored. The error is
supposed to be presented to the user if the exception handler succeeds.
Otherwise the standard Prolog warning message is printed.
This exception is used by the library(emacs_interface)
,
that integrates error handling with GNU~Emacs.