2.8 The class PlFail (version 2)
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
    • Packages
      • A C++ interface to SWI-Prolog
        • A C++ interface to SWI-Prolog (Version 2)
          • The class PlFail (version 2)
            • PlCheck() convenience function

2.8.1 PlCheck() convenience function

In general, wherever there is a method that wraps a C "PL_" function, PlCheck() can be used to return failure to Prolog from the "PL_" function.

The code for PlCheck() is very simple - it checks the return code and throws PlFail if the return code isn't "true". If the return code is from a Prolog function (that is, a function starting with "PL_"), the return code can be "false" either because of failure or because an exception happened. If the cause is an exception, then the only sensible thing is to return to Prolog immediately; throwing PlFail will do this. See also section 2.18.2.