4.15.2 Throwing Exceptions

You can throw exceptions from your own code using:

throw(+ExceptionTerm)   ISO

The argument to this predicate is the exception term, an arbitrary non-variable term. See mpg-ref-throw.

Please note: If the exception term contains attributed variables (see lib-atts) or suspended goals (see ref-sem-sec), those attributes don’t become part of the exception. To retain the attributes, you can use copy_term/3 (see ref-lte-cpt).

Send feedback on this subject.