Reputation: 53850
I am just starting with Erlang, so there's nothing complex in my code yet. Often I do mistakes which lead to runtime errors.
The issue is I always see things like this:
{"init terminating in do_boot",{undef,[{'lexer_app.beam',start,[],[]},{init,start_it,1,[]},{init,start_em,1,[]}]}}
Crash dump is being written to: erl_crash.dump...done init terminating in do_boot ()
Which hardly gives me quick information on what went wrong.
Thus, I wonder, is the only way to debug the errors like this to look into erl_crash.dump, which is, frankly, looks like total abrakadabra and I need to somehow figure out even simple stupid errors by looking into it?
The main questions, is it possible to get more human-friendly errors, like "5:6 Person variable of type string is not assignable to type number"?
What's the usual workflow of debugging the app?
Upvotes: 6
Views: 179
Reputation: 12547
If you just want to see pretty comnsole error message, you can do a little trick
7> {_type, {Reason, Stack}} = {"init terminating in do_boot",{undef,[{'lexer_app.beam',start,[],[]},{init,start_it,1,[]},{init,start_em,1,[]}]}}.
{"init terminating in do_boot",
{undef,[{'lexer_app.beam',start,[],[]},
{init,start_it,1,[]},
{init,start_em,1,[]}]}}
8> erlang:raise(exit, Reason, Stack).
** exception exit: undef
in function 'lexer_app.beam':start/0
called as 'lexer_app.beam':start()
in call from init:start_it/1
in call from init:start_em/1
Upvotes: 3
Reputation: 20014
You're not expected to be able to simply read the text of a crashdump file. Rather, you should be using the crashdump viewer, which is a graphical application that lets you view in a human-friendly manner all the information details a crashdump file contains.
Upvotes: 3