Aborting is implemented by throwing the reserved exception
unwind(abort)
. This exception can be caught using catch/3,
but the recovery goal is wrapped with a predicate that prunes the choice
points of the recovery goal (i.e., as once/1)
and re-throws the exception. This is illustrated in the example below,
where we press control-C and‘a’. See also section
4.10.2.
?- catch((repeat,fail), E, true). ^CAction (h for help) ? abort % Execution Aborted