Usually, exceptions that occur during debugging sessions are displayed
only in trace mode and for invocation boxes for
predicates with spypoints on them, and not during skips.
However, it is sometimes useful to make exceptions trap to the debugger
at the earliest opportunity instead. The hook predicate
user:error_exception/1
provides such a possibility:
error_exception(
+Exception)
hookuser:error_exception(
+Exception)
Note that this hook takes effect when the debugger arrives at an Exception port. For this to happen, procedure boxes have to be built, e.g. by running (the relevant parts of) the program in debug mode.
A useful definition that ensures that all standard error exceptions causes the debugger to enter trace mode, is as follows:
:- multifile user:error_exception/1. user:error_exception(error(_,_)).
(this example would not have worked prior to SICStus Prolog 4.0.5).