Skip to content

Commit 5af438f

Browse files
author
Simon MacMullen
committed
Also handle tokenising errors somewhat.
1 parent 77afb96 commit 5af438f

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

src/rabbit_control.erl

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -371,14 +371,19 @@ action(report, Node, _Args, _Opts, Inform) ->
371371
ok;
372372

373373
action(eval, Node, [Expr], _Opts, _Inform) ->
374-
{ok, Scanned, _} = erl_scan:string(Expr),
375-
case erl_parse:parse_exprs(Scanned) of
376-
{ok, Parsed} ->
377-
{value, Value, _} = unsafe_rpc(Node, erl_eval, exprs, [Parsed, []]),
378-
io:format("~p~n", [Value]),
379-
ok;
380-
{error, {1, erl_parse, Err}} ->
381-
{error, Err}
374+
case erl_scan:string(Expr) of
375+
{ok, Scanned, _} ->
376+
case erl_parse:parse_exprs(Scanned) of
377+
{ok, Parsed} ->
378+
{value, Value, _} = unsafe_rpc(
379+
Node, erl_eval, exprs, [Parsed, []]),
380+
io:format("~p~n", [Value]),
381+
ok;
382+
{error, {1, erl_parse, Err}} ->
383+
{error, Err}
384+
end;
385+
{error, {1, erl_scan, E}, _} ->
386+
{error, ["scan error: ", E]}
382387
end.
383388

384389
%%----------------------------------------------------------------------------

0 commit comments

Comments
 (0)