diff options
Diffstat (limited to 'src/rabbit_control.erl')
-rw-r--r-- | src/rabbit_control.erl | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/rabbit_control.erl b/src/rabbit_control.erl index 6fa25ba6..20486af5 100644 --- a/src/rabbit_control.erl +++ b/src/rabbit_control.erl @@ -98,6 +98,9 @@ start() -> {error, Reason} -> print_error("~p", [Reason]), rabbit_misc:quit(2); + {error_string, Reason} -> + print_error("~s", [Reason]), + rabbit_misc:quit(2); {badrpc, {'EXIT', Reason}} -> print_error("~p", [Reason]), rabbit_misc:quit(2); @@ -379,11 +382,11 @@ action(eval, Node, [Expr], _Opts, _Inform) -> Node, erl_eval, exprs, [Parsed, []]), io:format("~p~n", [Value]), ok; - {error, {1, erl_parse, Err}} -> - {error, Err} + {error, E} -> + {error_string, format_parse_error(E)} end; - {error, {1, erl_scan, E}, _} -> - {error, ["scan error: ", E]} + {error, E, _} -> + {error_string, format_parse_error(E)} end. %%---------------------------------------------------------------------------- @@ -459,6 +462,9 @@ system(Cmd) -> escape_quotes(Cmd) -> lists:flatten(lists:map(fun ($') -> "'\\''"; (Ch) -> Ch end, Cmd)). +format_parse_error({_Line, Mod, Err}) -> + lists:flatten(Mod:format_error(Err)). + %%---------------------------------------------------------------------------- default_if_empty(List, Default) when is_list(List) -> |