Intercept and print compile errors in a nicer way.

This commit is contained in:
Uku Taht
2016-01-13 13:31:04 +00:00
parent ac3cb8ed4e
commit 933e11acb9
2 changed files with 11 additions and 2 deletions

View File

@@ -24,6 +24,11 @@ defmodule Display do
"Assertion failed in #{source_file(module)}:#{line_number(expr)}"
end
def format_compile_error(error) do
trace = System.stacktrace |> Enum.take(2)
IO.puts(format_red(Exception.format(:error, error, trace)))
end
defp line_number({_, [line: line], _}) do
line
end