aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEric <[email protected]>2012-10-26 17:22:15 -0500
committerJordan Wilberding <[email protected]>2012-10-30 09:54:42 -0600
commit89e5d70f95f4d23811500d6bf2643714f6c95fa2 (patch)
treeddb34a1fbe93ff83a4102232e18430e3891eb928 /src
parent92dcabc086fbb88901d9b8549c07c702f977bd73 (diff)
downloadrelx-89e5d70f95f4d23811500d6bf2643714f6c95fa2.tar.gz
relx-89e5d70f95f4d23811500d6bf2643714f6c95fa2.tar.bz2
relx-89e5d70f95f4d23811500d6bf2643714f6c95fa2.zip
make config file errors more understandable to the user
Signed-off-by: Jordan Wilberding <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/rcl_prv_config.erl7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/rcl_prv_config.erl b/src/rcl_prv_config.erl
index 8fb32f2..7a1cd19 100644
--- a/src/rcl_prv_config.erl
+++ b/src/rcl_prv_config.erl
@@ -33,8 +33,9 @@ do(State) ->
lists:foldl(fun load_config/2, {ok, State}, ConfigFiles).
-spec format_error(Reason::term()) -> iolist().
-format_error({consult, Reason}) ->
- file:format_error(Reason);
+format_error({consult, ConfigFile, Reason}) ->
+ io_lib:format("Unable to read file ~s: ~s", [ConfigFile,
+ file:format_error(Reason)]);
format_error({invalid_term, Term}) ->
io_lib:format("Invalid term in config file: ~p", [Term]).
@@ -50,7 +51,7 @@ load_config(ConfigFile, {ok, State}) ->
ok = file:set_cwd(filename:dirname(ConfigFile)),
Result = case file:consult(ConfigFile) of
{error, Reason} ->
- ?RCL_ERROR({consult, Reason});
+ ?RCL_ERROR({consult, ConfigFile, Reason});
{ok, Terms} ->
lists:foldl(fun load_terms/2, {ok, State}, Terms)
end,