From 24ade76e94b010931bc528b1e95dc322d921e4a9 Mon Sep 17 00:00:00 2001 From: pmoura Date: Sun, 27 May 2007 21:40:17 +0000 Subject: [PATCH] Updated the behavior of the call_cleanup/2-3 built-in predicates to match SWI-Prolog regarding handling of exceptions. git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1890 b08c6af1-5177-4d33-ba66-4b1c6b8b522a --- pl/utils.yap | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pl/utils.yap b/pl/utils.yap index 84df5b52a..0045a97d7 100644 --- a/pl/utils.yap +++ b/pl/utils.yap @@ -191,8 +191,11 @@ call_cleanup(Goal, Catcher, Cleanup) :- Exception, '$cleanup_exception'(Exception,Catcher,Cleanup)). -'$cleanup_exception'(Exception, exception(Exception), Cleanup) :- - '$clean_call'(Cleanup). +'$cleanup_exception'(Exception, exception(Exception), Cleanup) :- !, + '$clean_call'(Cleanup), + throw(Exception). +'$cleanup_exception'(Exception, _, _) :- + throw(Exception). '$call_cleanup'(Goal, Cleanup, Result) :- '$freeze_goal'(Result, '$clean_call'(Cleanup)),