Skip to content

Commit

Permalink
ADDED: trap/1: aliases for e.g. type_error -> type_error(_,_)
Browse files Browse the repository at this point in the history
So one does not need to remember the number of arguments.
  • Loading branch information
JanWielemaker committed Dec 19, 2024
1 parent 21264b8 commit 1d3f462
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions library/prolog_debug.pl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Author: Jan Wielemaker
E-mail: [email protected]
WWW: http://www.swi-prolog.org
Copyright (c) 2021-2023, SWI-Prolog Solutions b.v.
Copyright (c) 2021-2024, SWI-Prolog Solutions b.v.
All rights reserved.
Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -259,9 +259,15 @@
%
% Define short hands for commonly used exceptions.

trap_alias(det, determinism_error(_Pred, _Declared, _Observed, property)).
trap_alias(=>, existence_error(rule, _)).

trap_alias(det, determinism_error(_Pred, _Declared, _Observed, property)).
trap_alias(=>, existence_error(rule, _)).
trap_alias(existence_error, existence_error(_,_)).
trap_alias(type_error, type_error(_,_)).
trap_alias(domain_error, domain_error(_,_)).
trap_alias(permission_error, permission_error(_,_,_)).
trap_alias(representation_error, representation_error(_)).
trap_alias(resource_error, resource_error(_)).
trap_alias(syntax_error, syntax_error(_)).

trapping :-
findall(exception(Name, Term, NotCaught, Caught),
Expand Down

0 comments on commit 1d3f462

Please sign in to comment.