• 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

A.17 library(exceptions): Exception classification
All Application Manual Name SummaryHelp

  • Documentation
    • Reference manual
      • The SWI-Prolog library
        • library(exceptions): Exception classification
          • catch/4
          • exception/2
          • error_term/2
          • exception_term/2
          • exception_type/2
    • Packages
Availability::- use_module(library(exceptions)).(can be autoloaded)
Source[det]exception(:Type, --Ball)
[semidet]exception(:Type, +Ball)
If Ball is unbound, adds a delayed goal that tests the error belongs to Type when Ball is instantiated (by catch/3). Else succeed is error is of the specified Type.

Note that the delayed goal is added using freeze/2 and therefore the stepwise instantiation of Ball does not work, e.g. exception(file_error, error(Formal,_)) immediately fails.

Error types may be defined or extended (e.g., by libraries) by adding clauses to the multifile predicates error_term/2 and exception_term/2. Modules may (re-)define local error types using the exception_type/2 directive.

ClioPatria (version V3.1.1-51-ga0b30a5)