catch_with_backtrace(:Goal,
+Catcher, :Recover)library(prolog_stack) is loaded and an
exception of the shape error(Format, Context) is raised
Context is extended with a backtrace. To catch an error and
print its message including a backtrace, use the following template:
:- use_module(library(prolog_stack)).
...,
catch_with_backtrace(Goal, Error,
print_message(error, Error)),
...,
This is good practice for a catch-all wrapper around an
application. See also main/0
from library library(main).