diff options
author | Björn Gustavsson <[email protected]> | 2016-06-29 10:15:48 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2016-06-29 10:15:48 +0200 |
commit | d0ae94966b4224f56f17e47e7fed2a979aad91ef (patch) | |
tree | 478a5cca77a80223ee39a7aa4269edfd06badb72 | |
parent | fdd99d206f15ce8e088b5c63b84c0e7a9b5b34d5 (diff) | |
parent | b67da3610ace6d4e998bdfb458343165e205fae8 (diff) | |
download | otp-d0ae94966b4224f56f17e47e7fed2a979aad91ef.tar.gz otp-d0ae94966b4224f56f17e47e7fed2a979aad91ef.tar.bz2 otp-d0ae94966b4224f56f17e47e7fed2a979aad91ef.zip |
Merge branch 'maint'
* maint:
Fix try-catch when writing makefile
Show error reason when compiler cannot write file
-rw-r--r-- | lib/compiler/src/compile.erl | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/compiler/src/compile.erl b/lib/compiler/src/compile.erl index 82ff8a95f3..e2eff2a89b 100644 --- a/lib/compiler/src/compile.erl +++ b/lib/compiler/src/compile.erl @@ -236,6 +236,8 @@ format_error({epp,E}) -> epp:format_error(E); format_error(write_error) -> "error writing file"; +format_error({write_error, Error}) -> + io_lib:format("error writing file: ~ts", [file:format_error(Error)]); format_error({rename,From,To,Error}) -> io_lib:format("failed to rename ~ts to ~ts: ~ts", [From,To,file:format_error(Error)]); @@ -1206,7 +1208,7 @@ makedep_output(#compile{code=Code,options=Opts,ofile=Ofile}=St) -> end, {ok,St} catch - exit:_ -> + error:_ -> %% Couldn't write to output Makefile. Err = {St#compile.ifile,[{none,?MODULE,write_error}]}, {error,St#compile{errors=St#compile.errors++[Err]}} @@ -1479,8 +1481,8 @@ save_binary_1(St) -> end, {error,St#compile{errors=St#compile.errors ++ Es}} end; - {error,_Error} -> - Es = [{Tfile,[{none,compile,write_error}]}], + {error,Error} -> + Es = [{Tfile,[{none,compile,{write_error,Error}}]}], {error,St#compile{errors=St#compile.errors ++ Es}} end. @@ -1628,8 +1630,8 @@ listing(LFun, Ext, St) -> LFun(Lf, Code), ok = file:close(Lf), {ok,St}; - {error,_Error} -> - Es = [{Lfile,[{none,compile,write_error}]}], + {error,Error} -> + Es = [{Lfile,[{none,compile,{write_error,Error}}]}], {error,St#compile{errors=St#compile.errors ++ Es}} end. |