From 6d6fff2612dd77dd6251927d71967d42899e7c60 Mon Sep 17 00:00:00 2001 From: Hans Svensson Date: Thu, 28 Feb 2019 09:56:16 +0100 Subject: [PATCH] Better error handling when init is present but wrong --- src/aeso_compiler.erl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/aeso_compiler.erl b/src/aeso_compiler.erl index db63a70..30e1136 100644 --- a/src/aeso_compiler.erl +++ b/src/aeso_compiler.erl @@ -117,9 +117,12 @@ join_errors(Prefix, Errors, Pfun) -> check_call(Source, "init" = FunName, Args, Options) -> PatchFun = fun(T) -> {tuple, [typerep, T]} end, case check_call(Source, FunName, Args, Options, PatchFun) of - {error, _} when Args == [] -> + Err = {error, _} when Args == [] -> %% Try with default init-function - check_call(insert_init_function(Source, Options), FunName, Args, Options, PatchFun); + case check_call(insert_init_function(Source, Options), FunName, Args, Options, PatchFun) of + {error, _} -> Err; %% The first error is most likely better... + Res -> Res + end; Res -> Res end;