basho/lager — Issue #31: Handle other kinds of crash_reports
Author: Vagabond
Created: 2011-12-15 21:08:30+00:00
State: open

Webmachine generates crash_reports like this:

```
[{initial_call,
{mochiweb_acceptor,init,
['Argument__1','Argument__2','Argument__3']}},
{pid,<0.1061.0>},
{registered_name,[]},
{error_info,
{error,function_clause,
[{mochiweb,new_request,
[{#Port<0.6956>,{"WTF","1.1",{0,9}},[]}]},
{mochiweb_http,headers,5},
{proc_lib,init_p_do_apply,3}]}},
{ancestors,['http_127.0.0.1:8098',riak_core_sup,<0.75.0>]},
{messages,[]},
{links,[<0.91.0>,#Port<0.6956>]},
{dictionary,[]},
{trap_exit,false},
{status,running},
{heap_size,377},
{stack_size,24},
{reductions,1152}]
```

These are unusual in that the error_info is {error, Reason, Stacktrace} as opposed to the more common:

```{exit,
{function_clause,
[{crash,function,[{}]},
{crash,handle_call,3},
{gen_server,handle_msg,5},
{proc_lib,init_p_do_apply,3}]},
[{gen_server,terminate,6},{proc_lib,init_p_do_apply,3}]}
```

Which is {exit, Reason, Stacktrace}, but Reason has more information in it, for some reason.

I can't even generate the first style of crash reports without sending garbage to webmachine on the http port. exit(), erlang:error() and spawn_link all generate the {exit, ...} style crash reports.