The built-in predicate
unknown/2 can be
used to determine or set Prolog's behavior when it comes across an
undefined predicate. By default, unknown procedures raise an
Procedures that are known to be dynamic fail when there are no clauses for them.
When an undefined predicate is called and the undefined predicate
behavior is set to
error rather than
unknown_predicate_handler/3 is called in module
defining this predicate, you can (selectively) trap calls to undefined
predicates in a program.