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

@@ -3,8 +3,12 @@ defmodule Watcher do
def callback(file, events) do
if Enum.member?(events, :modified) do
[{mod, _}] = Code.load_file(file)
Runner.run(mod)
try do
[{mod, _}] = Code.load_file(file)
Runner.run(mod)
rescue
e -> Display.format_compile_error(e)
end
end
end
end