aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/compile.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2012-08-31 08:19:17 +0200
committerBjörn Gustavsson <[email protected]>2012-10-09 15:24:39 +0200
commitdba5396cce0e94e5344ee910324c0e03d34dcaaa (patch)
tree725da398964c1dd99ecf0d47b40fa62e5e38c0bb /lib/compiler/src/compile.erl
parentd3f886a225adfa196ec5fbc55ea6ebcae8c42197 (diff)
downloadotp-dba5396cce0e94e5344ee910324c0e03d34dcaaa.tar.gz
otp-dba5396cce0e94e5344ee910324c0e03d34dcaaa.tar.bz2
otp-dba5396cce0e94e5344ee910324c0e03d34dcaaa.zip
compile: Give a friendler error message if a parse transform cannot be found
Don't throw the parse tree in the face of the user. OTP-8707
Diffstat (limited to 'lib/compiler/src/compile.erl')
-rw-r--r--lib/compiler/src/compile.erl6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/compiler/src/compile.erl b/lib/compiler/src/compile.erl
index 0a368df5d6..818945d0fd 100644
--- a/lib/compiler/src/compile.erl
+++ b/lib/compiler/src/compile.erl
@@ -224,6 +224,8 @@ format_error({delete_temp,File,Error}) ->
[File,file:format_error(Error)]);
format_error({parse_transform,M,R}) ->
io_lib:format("error in parse transform '~s': ~p", [M, R]);
+format_error({undef_parse_transform,M}) ->
+ io_lib:format("undefined parse transform '~s'", [M]);
format_error({core_transform,M,R}) ->
io_lib:format("error in core transform '~s': ~p", [M, R]);
format_error({crash,Pass,Reason}) ->
@@ -850,6 +852,10 @@ foldl_transform(St, [T|Ts]) ->
{error,Es,Ws} ->
{error,St#compile{warnings=St#compile.warnings ++ Ws,
errors=St#compile.errors ++ Es}};
+ {'EXIT',{undef,_}} ->
+ Es = [{St#compile.ifile,[{none,compile,
+ {undef_parse_transform,T}}]}],
+ {error,St#compile{errors=St#compile.errors ++ Es}};
{'EXIT',R} ->
Es = [{St#compile.ifile,[{none,compile,{parse_transform,T,R}}]}],
{error,St#compile{errors=St#compile.errors ++ Es}};