diff options
| author | Simon MacMullen <simon@rabbitmq.com> | 2011-11-24 17:07:36 +0000 |
|---|---|---|
| committer | Simon MacMullen <simon@rabbitmq.com> | 2011-11-24 17:07:36 +0000 |
| commit | 6f031d445e5d8fff88a0edbd2ffc51d3a924f621 (patch) | |
| tree | 11a28fd27147c24cbc9a2a4f69d2bfa8b5ae63fc | |
| parent | 218a9c73b6de4a7b3eeec84d17e3d1a44c4bea2d (diff) | |
| download | rabbitmq-server-git-6f031d445e5d8fff88a0edbd2ffc51d3a924f621.tar.gz | |
Handle the most common parsing error nicely.
| -rw-r--r-- | src/rabbit_control.erl | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/rabbit_control.erl b/src/rabbit_control.erl index 9d47a78f16..6e57b1baa3 100644 --- a/src/rabbit_control.erl +++ b/src/rabbit_control.erl @@ -372,10 +372,14 @@ action(report, Node, _Args, _Opts, Inform) -> action(eval, Node, [Expr], _Opts, _Inform) -> {ok, Scanned, _} = erl_scan:string(Expr), - {ok, Parsed} = erl_parse:parse_exprs(Scanned), - {value, Value, _Bindings} = rpc_call(Node, erl_eval, exprs, [Parsed, []]), - io:format("~p~n", [Value]), - ok. + case erl_parse:parse_exprs(Scanned) of + {ok, Parsed} -> + {value, Value, _} = rpc_call(Node, erl_eval, exprs, [Parsed, []]), + io:format("~p~n", [Value]), + ok; + {error, {1, erl_parse, Err}} -> + {error, Err} + end. %%---------------------------------------------------------------------------- |
