:- use_module(library(error)).(can be autoloaded)
Suppose an argument must be a non-negative integer. If the actual argument is not an integer, this is a type_error. If it is a negative integer, it is a domain_error.
Typical borderline cases are predicates accepting a compound term,
point(X,Y). One could argue that the basic type is a
compound-term and any other compound term is a domain error. Most Prolog
programmers consider each compound as a type and would consider a
compoint that is not
point(_,_) a type_error.