setup_call_cleanup(Setup, Goal, Cleanup)
with
additional information on the reason for calling Cleanup.
Prior to calling Cleanup, Catcher unifies with the
termination code (see below). If this unification fails, Cleanup
is
not called.
!
?- setup_call_catcher_cleanup(true, (X=1;X=2), Catcher, writeln(Catcher)), throw(ball). external_exception(ball) ERROR: Unhandled exception: Unknown message: ball