This section describes the predicate exception/3,
which can be defined by the user in the module
user as a
multifile predicate. Unlike the name suggests, this is actually a hook
predicate that has no relation to Prolog exceptions as defined by the
The predicate exception/3 is called by the kernel on a couple of events, allowing the user to `fix' errors just in time events. The mechanism allows for lazy creation of objects such as predicates.
If this hook predicate succeeds it must instantiate the Action
argument to the atom
fail to make the operation fail
retry to tell Prolog to retry the operation or
to make the system generate an exception. The action
only makes sense if this hook modified the environment such that the
operation can now succeed without error.