fix exceptions in setup.
This commit is contained in:
parent
97a27bd4b6
commit
4c47f4188e
@ -66,11 +66,17 @@ setup_call_cleanup(Setup, Goal, Cleanup) :-
|
|||||||
|
|
||||||
setup_call_catcher_cleanup(Setup, Goal, Catcher, Cleanup) :-
|
setup_call_catcher_cleanup(Setup, Goal, Catcher, Cleanup) :-
|
||||||
yap_hacks:disable_interrupts,
|
yap_hacks:disable_interrupts,
|
||||||
'$check_goal_for_setup_call_cleanup'(Setup, setup_call_catcher_cleanup(Setup, Goal, Catcher, Cleanup)),
|
'$check_goal_for_setup_call_cleanup'(Setup, setup_call_cleanup(Setup, Goal, Cleanup)),
|
||||||
'$do_setup'(Setup),
|
catch('$do_setup'(Setup),Exception,'$handle_broken_setup'(Exception)),
|
||||||
'$check_goal_for_setup_call_cleanup'(Cleanup, setup_call_catcher_cleanup(Setup, Goal, Catcher, Cleanup)),
|
'$check_goal_for_setup_call_cleanup'(Cleanup, setup_call_cleanup(Setup, Goal, Cleanup)),
|
||||||
'$safe_call_cleanup'(Goal,Cleanup,Catcher,Exception).
|
'$safe_call_cleanup'(Goal,Cleanup,Catcher,Exception).
|
||||||
|
|
||||||
|
% make sure we don't lose interrupts if we get exceptions
|
||||||
|
% with setup.
|
||||||
|
'$handle_broken_setup'(Setup) :-
|
||||||
|
yap_hacks:enable_interrupts,
|
||||||
|
throw(Exception).
|
||||||
|
|
||||||
'$check_goal_for_setup_call_cleanup'(Goal, G) :-
|
'$check_goal_for_setup_call_cleanup'(Goal, G) :-
|
||||||
strip_module(Goal, _, MG),
|
strip_module(Goal, _, MG),
|
||||||
(
|
(
|
||||||
|
Reference in New Issue
Block a user