:- module(error, [must_be/2,
can_be/2,
+ instantiation_error/0,
instantiation_error/1,
+ domain_error/2,
domain_error/3,
+ type_error/2,
type_error/3,
call_with_error_context/2
]).
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Shorthands for throwing ISO errors.
+
+ The variants without context promote the use of
+ call_with_error_context/2.
+
+ The variants *with* context would not have been needed if
+ call_with_error_context/2 had been found earlier. In the future,
+ we may be able to remove them.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+instantiation_error :-
+ throw(error(instantiation_error, [])).
+
+domain_error(Type, Term) :-
+ throw(error(domain_error(Type, Term), [])).
+
+type_error(Type, Term) :-
+ throw(error(type_error(Type, Term), [])).
+
+
instantiation_error(Context) :-
throw(error(instantiation_error, Context)).