diff options
author | Heinz N. Gies <heinz@licenser.net> | 2016-02-25 22:02:55 -0500 |
---|---|---|
committer | Heinz N. Gies <heinz@licenser.net> | 2016-04-16 02:45:38 +0200 |
commit | bc9746881f58171b91cdc9c6494299b3856e21fe (patch) | |
tree | 3d9cb6d8338caf5230ffa4f5fbb6d3568fc15750 | |
parent | 8fe2d0c8a4601955665a8955906b70bbbb9767de (diff) |
Write rebar3.crashdump on errors
-rw-r--r-- | src/rebar3.erl | 6 | ||||
-rw-r--r-- | src/rebar_state.erl | 3 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/rebar3.erl b/src/rebar3.erl index c1a1ae4..75eefa0 100644 --- a/src/rebar3.erl +++ b/src/rebar3.erl @@ -265,7 +265,8 @@ handle_error({error, rebar_abort}) -> handle_error({error, {Module, Reason}}) -> case code:which(Module) of non_existing -> - ?ERROR("Uncaught error in rebar_core. Run with DEBUG=1 to see stacktrace", []), + file:write_file("rebar3.crashdump", io_lib:fwrite("~p: ~p~n~p~n~n", [Module, Reason, erlang:get_stacktrace()])), + ?ERROR("Uncaught error in rebar_core. Run with DEBUG=1 to see stacktrace rebar3.crashdump", []), ?DEBUG("Uncaught error: ~p ~p", [Module, Reason]), ?INFO("When submitting a bug report, please include the output of `rebar3 report \"your command\"`", []); _ -> @@ -278,7 +279,8 @@ handle_error({error, Error}) when is_list(Error) -> handle_error(Error) -> %% Nothing should percolate up from rebar_core; %% Dump this error to console - ?ERROR("Uncaught error in rebar_core. Run with DEBUG=1 to see stacktrace", []), + file:write_file("rebar3.crashdump", io_lib:fwrite("Error: ~p~n~p~n~n", [Error, erlang:get_stacktrace()])), + ?ERROR("Uncaught error in rebar_core. Run with DEBUG=1 to see stacktrace or consult rebar3.crashdump", []), ?DEBUG("Uncaught error: ~p", [Error]), case erlang:get_stacktrace() of [] -> ok; diff --git a/src/rebar_state.erl b/src/rebar_state.erl index a613a00..f438700 100644 --- a/src/rebar_state.erl +++ b/src/rebar_state.erl @@ -417,7 +417,8 @@ create_logic_providers(ProviderModules, State0) -> catch C:T -> ?DEBUG("~p: ~p ~p", [C, T, erlang:get_stacktrace()]), - throw({error, "Failed creating providers. Run with DEBUG=1 for stacktrace."}) + file:write_file("rebar3.crashdump", io_lib:fwrite("~p: ~p~n~p~n~n~p", [C, T, erlang:get_stacktrace(), State0])), + throw({error, "Failed creating providers. Run with DEBUG=1 for stacktrace rebar3.crashdump."}) end. to_list(#state_t{} = State) -> |