Skip to content

Instantly share code, notes, and snippets.

@keynslug
Created May 20, 2015 15:17
Show Gist options
  • Save keynslug/5e922d8b9a1e49a6e1da to your computer and use it in GitHub Desktop.
Save keynslug/5e922d8b9a1e49a6e1da to your computer and use it in GitHub Desktop.
unite.patch
diff --git a/src/unite_compact.erl b/src/unite_compact.erl
index 012908f..9b03e61 100644
--- a/src/unite_compact.erl
+++ b/src/unite_compact.erl
@@ -246,18 +246,21 @@ format_case(Failure, ST, Color) ->
format_source(Failure, ST) ->
case get(source, Failure) of
undefined ->
- format_stack_line(hd(ST));
+ format_stack_line(ST);
MFA ->
format_stack_line(add_info(MFA, ST))
end.
-format_stack_line({M, F, A, I}) ->
+format_stack_line([{M, F, A, I} | _]) ->
case {get(file, I), get(line, I)} of
{undefined, undefined} ->
io_lib:format("~p:~p/~p", [M, F, A]);
{File, L} ->
io_lib:format("~p/~p (~s:~p)", [F, A, File, L])
- end.
+ end;
+
+format_stack_line([]) ->
+ "unknown location".
format_exception(Error, Reason, Stacktrace) ->
lib:format_exception(1, Error, Reason, Stacktrace,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment