Properly handle compilation errors in Erlang compiler