Skip to content

Instantly share code, notes, and snippets.

@nox
Last active December 16, 2015 23:39
Show Gist options
  • Save nox/5515309 to your computer and use it in GitHub Desktop.
Save nox/5515309 to your computer and use it in GitHub Desktop.
Attempt at making Erlang stacktraces more readable
$ bin/erl
Erlang R16B01 (erts-5.10.2) [source-7e9ae30] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false]
Eshell V5.10.2 (abort with ^G)
1> spawn(fun () -> (fun () -> 1 + foo end)(), get(foo) end).
<0.35.0>
=ERROR REPORT==== 4-May-2013::02:12:25 ===
Error in process <0.35.0> with exit value: badarith
at erlang:'+'(1, foo)
at erl_eval:do_apply/6("erl_eval.erl":573)
at erl_eval:exprs/5("erl_eval.erl":118)
Ruby-like:
<BIF>: from erlang:'+'(1, foo)
erl_eval.erl:573: in erl_eval:do_apply/6
erl_eval.erl:118: in erl_eval:exprs/5
SBCL-like:
1: erlang:'+'(X1, X2)
Arguments:
X1 = 1
X2 = foo
2: erl_eval:do_apply/6
At erl_eval.erl:573
3: erl_eval:exprs/5
At erl_eval.erl:118
@yfyf
Copy link

yfyf commented May 5, 2013

You don't provide the actual throw reason in the transformed version, which is crucial.

The SBCL-like version is way too long IMHO, the ruby one is... meh, I don't see much of a difference.

@nox
Copy link
Author

nox commented May 5, 2013

@yfyf: I'm just tweaking the stacktrace output, please consider there is the usual "Error in process ...: badarith" before each of them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment