Structured parse_errors and type_errors

This commit is contained in:
Hans Svensson
2019-09-02 11:14:57 +02:00
committed by Ulf Norell
parent 9e955d5958
commit 249b61238e
11 changed files with 427 additions and 310 deletions
+1 -3
View File
@@ -74,15 +74,13 @@ do_contract_interface(Type, ContractString, Options) ->
string -> do_render_aci_json(JArray)
end
catch
throw:{type_errors, Errors} -> {error, Errors};
%% The compiler errors.
error:{parse_errors, Errors} ->
{error, join_errors("Parse errors", Errors, fun(E) -> E end)};
error:{type_errors, Errors} ->
{error, join_errors("Type errors", Errors, fun(E) -> E end)};
error:{code_errors, Errors} ->
{error, join_errors("Code errors", Errors,
fun (E) -> io_lib:format("~p", [E]) end)}
%% General programming errors in the compiler just signal error.
end.
join_errors(Prefix, Errors, Pfun) ->