catch exceptions thrown from initialization goals (#852)
This commit is contained in:
@@ -105,23 +105,23 @@ file_load(_, _).
|
|||||||
|
|
||||||
file_load(Stream, Path, Evacuable) :-
|
file_load(Stream, Path, Evacuable) :-
|
||||||
create_file_load_context(Stream, Path, Evacuable),
|
create_file_load_context(Stream, Path, Evacuable),
|
||||||
catch(loader:load_loop(Stream, Evacuable),
|
catch((loader:load_loop(Stream, Evacuable),
|
||||||
|
loader:run_initialization_goals),
|
||||||
E,
|
E,
|
||||||
builtins:(loader:unload_evacuable(Evacuable),
|
builtins:(loader:unload_evacuable(Evacuable),
|
||||||
loader:'$print_message_and_fail'(E),
|
loader:'$print_message_and_fail'(E),
|
||||||
builtins:throw(E))),
|
builtins:throw(E))),
|
||||||
run_initialization_goals,
|
|
||||||
'$pop_load_context'.
|
'$pop_load_context'.
|
||||||
|
|
||||||
|
|
||||||
load(Stream) :-
|
load(Stream) :-
|
||||||
create_load_context(Stream, Evacuable),
|
create_load_context(Stream, Evacuable),
|
||||||
catch(loader:load_loop(Stream, Evacuable),
|
catch((loader:load_loop(Stream, Evacuable),
|
||||||
|
loader:run_initialization_goals),
|
||||||
E,
|
E,
|
||||||
builtins:(loader:unload_evacuable(Evacuable),
|
builtins:(loader:unload_evacuable(Evacuable),
|
||||||
loader:'$print_message_and_fail'(E),
|
loader:'$print_message_and_fail'(E),
|
||||||
builtins:throw(E))),
|
builtins:throw(E))),
|
||||||
run_initialization_goals,
|
|
||||||
'$pop_load_context',
|
'$pop_load_context',
|
||||||
false. %% Clear the heap.
|
false. %% Clear the heap.
|
||||||
load(_).
|
load(_).
|
||||||
|
|||||||
Reference in New Issue
Block a user