2.16 Exceptions (version 2)
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
    • Packages
      • A C++ interface to SWI-Prolog
        • A C++ interface to SWI-Prolog (Version 2)
          • Exceptions (version 2)
            • The class PlException (version 2)
            • The class PlTypeError (version 2)
            • The class PlDomainError (version 2)

2.16.1 The class PlException (version 2)

This subclass of PlTerm is used to represent exceptions. Currently defined methods are:

PlException :: PlException(const PlTerm &)
Create an exception from a general Prolog term. This provides the interface for throwing any Prolog terms as an exception.
std::string as_string()
The exception is translated into a message as produced by print_message/2. The character data is stored in a ring. Example:
  ...;
  try
  { PlCall("consult(load)");
  } catch ( PlException& ex )
  { cerr << ex.as_string() << endl;
  }
int plThrow()
Used in the PREDICATE() wrapper to pass the exception to Prolog. See PL_raise_exeption().