Merge pull request #1235 from triska/better-initialization-warning
ENHANCED: more specific warning when initialization/1 fails (#1149)
This commit is contained in:
@@ -92,16 +92,19 @@ run_initialization_goals(Module) :-
|
|||||||
% FIXME: failing here. also, see add_module.
|
% FIXME: failing here. also, see add_module.
|
||||||
findall(Module:Goal, '$call'(builtins:retract(Module:'$initialization_goals'(Goal))), Goals),
|
findall(Module:Goal, '$call'(builtins:retract(Module:'$initialization_goals'(Goal))), Goals),
|
||||||
abolish(Module:'$initialization_goals'/1),
|
abolish(Module:'$initialization_goals'/1),
|
||||||
( maplist(Module:call, Goals) ->
|
maplist(loader:success_or_warning(Module), Goals)
|
||||||
true
|
|
||||||
; %% initialization goals can fail without thwarting the load.
|
|
||||||
write('Warning: initialization/1 failed for: '),
|
|
||||||
writeq(maplist(Module:call, Goals)),
|
|
||||||
nl
|
|
||||||
)
|
|
||||||
; true
|
; true
|
||||||
).
|
).
|
||||||
|
|
||||||
|
success_or_warning(Module, Goal) :-
|
||||||
|
( Module:call(Goal) ->
|
||||||
|
true
|
||||||
|
; %% initialization goals can fail without thwarting the load.
|
||||||
|
write('Warning: initialization/1 failed for: '),
|
||||||
|
writeq(Goal),
|
||||||
|
nl
|
||||||
|
).
|
||||||
|
|
||||||
run_initialization_goals :-
|
run_initialization_goals :-
|
||||||
prolog_load_context(module, Module),
|
prolog_load_context(module, Module),
|
||||||
run_initialization_goals(user),
|
run_initialization_goals(user),
|
||||||
|
|||||||
Reference in New Issue
Block a user