diff options
author | Serge Aleynikov <saleyn@gmail.com> | 2019-06-26 18:20:38 +0600 |
---|---|---|
committer | Serge Aleynikov <saleyn@gmail.com> | 2019-06-26 18:20:38 +0600 |
commit | d5188093519bc45433a6baf528438cc773307059 (patch) | |
tree | f0a1f8e058b8c291192ce942fa22591d975b36d4 | |
parent | f23e5a423347c0b04d8513410132a875f3767340 (diff) |
Make missing file report more comprehensive
-rw-r--r-- | src/rebar_compiler_erl.erl | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/rebar_compiler_erl.erl b/src/rebar_compiler_erl.erl index 1ad16d8..6266743 100644 --- a/src/rebar_compiler_erl.erl +++ b/src/rebar_compiler_erl.erl @@ -74,11 +74,15 @@ needed_files(Graph, FoundFiles, _, AppInfo) -> {OtherErls, ErlOpts ++ AdditionalOpts}}. dependencies(Source, SourceDir, Dirs) -> - {ok, Fd} = file:open(Source, [read]), - Incls = parse_attrs(Fd, [], SourceDir), - AbsIncls = expand_file_names(Incls, Dirs), - ok = file:close(Fd), - AbsIncls. + case file:open(Source, [read]) of + {ok, Fd} -> + Incls = parse_attrs(Fd, [], SourceDir), + AbsIncls = expand_file_names(Incls, Dirs), + ok = file:close(Fd), + AbsIncls; + {error, Reason} -> + throw({cannot_read_file, Source, file:format_error(Reason)}) + end. compile(Source, [{_, OutDir}], Config, ErlOpts) -> case compile:file(Source, [{outdir, OutDir} | ErlOpts]) of |