![]() |
YAP 7.1.0
|
This code is based oon the SWI predicates to simplify error generation and checking. More...
This code is based oon the SWI predicates to simplify error generation and checking.
Adapted to use YAP built-ins
Its implementation is based on a discussion on the SWI-Prolog mailinglist on best practices in error handling The utility predicate must_be/2 provides simple run-time type validation The *_error predicates are simple wrappers around throw/1 to simplify throwing the most common ISO error terms
YAP reuses the code with some extensions, and supports interfacing to some C-builtins
class type_error/2 |
type_error(+Type, +Term)
%%
class domain_error/3 |
domain_error(+Type, +Value, +Term)
%%
class existence_error/2 |
existence_error(+Type, +Term)
%%
class permission_error/3 |
permission_error(+Action, +Type, +Term)
%%
class instantiation_error/1 |
instantiation_error(+Term)
%%
class representation_error/1 |
representation_error(+Reason)
% % Throw ISO compliant error messages
class is_not/2 |
is_not(+Type, @Term)
% % Throws appropriate error It is known that Term is not of type % Type % %
type_error(Type,Term) | % |
instantiation_error |