Availability:C-language interface function
term_t PL_exception(qid_t
qid)If PL_next_solution()
fails, this can be due to normal failure of the Prolog call, or because
an exception was raised using throw/1.
This function returns a handle to the exception term if an exception was
raised, or 0 if the Prolog goal simply failed. If there is an exception,
PL_exception()
allocates a term-handle using PL_new_term_ref()
that is used to return the exception term.
Additionally, PL_exception(0)
returns the pending
exception in the current query or 0 if no exception is pending. This can
be used to check the error status after a failing call to, e.g., one of
the unification functions.