throw handling

This commit is contained in:
Vitor Santos Costa 2016-07-31 10:40:47 -05:00
parent 275e2c0059
commit f7a2c479e7

View File

@ -49,7 +49,7 @@ Errors are terms of the form:
:- use_system_module( '$messages', [file_location/2, :- use_system_module( '$messages', [file_location/2,
generate_message/3, generate_message/3,
translate_message/3]). translate_message/4]).
/** /**
@ -109,14 +109,29 @@ system_error(Type,Goal,Culprit) :-
flush_output, flush_output,
fail. fail.
'$process_error'('$abort', top) :- !, '$process_error'('$forward'(Msg), _) :-
print_message(informational,abort(user)). !,
'$process_error'('$abort', _) :- !, throw( '$forward'(Msg) ).
throw('$abort'). '$process_error'('$abort', Level) :-
'$process_error'(abort, top) :- !, !,
print_message(informational,abort(user)). '$process_error'(abort, Level).
'$process_error'(abort, _) :- !, '$process_error'(abort, Level) :-
throw(abort). !,
(
Level \== top
->
throw( abort )
;
current_prolog_flag(break_level, 0)
->
print_message(informational,abort(user)),
fail
;
current_prolog_flag(break_level, I0),
I is I0-1,
current_prolog_flag(break_level, I),
throw(abort)
).
'$process_error'(error(thread_cancel(_Id), _G),top) :- !. '$process_error'(error(thread_cancel(_Id), _G),top) :- !.
'$process_error'(error(thread_cancel(Id), G), _) :- !, '$process_error'(error(thread_cancel(Id), G), _) :- !,
throw(error(thread_cancel(Id), G)). throw(error(thread_cancel(Id), G)).