• Places
    • Home
    • Graphs
    • Prefixes
  • Admin
    • Users
    • Settings
    • Plugins
    • Statistics
  • CPACK
    • Home
    • List packs
    • Submit pack
  • Repository
    • Load local file
    • Load from HTTP
    • Load from library
    • Remove triples
    • Clear repository
  • Query
    • YASGUI SPARQL Editor
    • Simple Form
    • SWISH Prolog shell
  • Help
    • Documentation
    • Tutorial
    • Roadmap
    • HTTP Services
  • Login

4.10 Exception handling
All Application Manual Name SummaryHelp

  • Documentation
    • Reference manual
      • Built-in Predicates
        • Exception handling
          • catch/3
          • throw/1
          • catch_with_backtrace/3
          • Unwind exceptions
          • Urgency of exceptions
          • Debugging and exceptions
          • The exception term
    • Packages
Availability:built-in
Sourcecatch_with_backtrace(:Goal, +Catcher, :Recover)
As catch/3, but if library 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).

ClioPatria (version V3.1.1-51-ga0b30a5)