diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/rebar_prv_cover.erl | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/rebar_prv_cover.erl b/src/rebar_prv_cover.erl index 4bcef29..791e4e9 100644 --- a/src/rebar_prv_cover.erl +++ b/src/rebar_prv_cover.erl @@ -150,12 +150,20 @@ analyze_to_file(Mod, State, Task) -> ok = filelib:ensure_dir(filename:join([TaskDir, "dummy.html"])), case code:ensure_loaded(Mod) of {module, _} -> - cover:analyze_to_file(Mod, mod_to_filename(TaskDir, Mod), [html]); + write_file(Mod, mod_to_filename(TaskDir, Mod)); {error, _} -> ?WARN("Can't load module ~ts.", [Mod]), {ok, []} end. +write_file(Mod, FileName) -> + case cover:analyze_to_file(Mod, FileName, [html]) of + {ok, File} -> {ok, File}; + {error, Reason} -> + ?WARN("Couldn't write annotated file for module ~p for reason ~p", [Mod, Reason]), + {ok, []} + end. + mod_to_filename(TaskDir, M) -> filename:join([TaskDir, atom_to_list(M) ++ ".html"]). |