[erlang-questions] Line numbers in escript errors?
zxq9@REDACTED
zxq9@REDACTED
Tue Jul 16 13:22:41 CEST 2019
On 2019年7月16日火曜日 14時01分57秒 JST Danil Zagoskin wrote:
> Hi!
>
> Do you use compile mode?
> -mode(compile).
>
> On Tue, Jul 16, 2019 at 1:38 PM Roger Lipscombe <roger@REDACTED>
> wrote:
>
> > When something goes wrong in my escript, I get something like this:
> >
> > escript: exception error: no match of right hand side value
> > {ok, ...}
> > in function erl_eval:expr/5 (erl_eval.erl, line 453)
> > in call from erl_eval:exprs/5 (erl_eval.erl, line 126)
> > in call from lists:foldl/3 (lists.erl, line 1263)
> >
> > ...but it doesn't tell me which line in my script was at fault. Is
> > there a way to get escript to divulge that information?
Another useful thing is to make sure your set to unicode mode with
io:setopts/1. This can be perplexing to troubleshoot.
I tend to start experiments with this as a template:
#! /usr/bin/env escript
-mode(compile).
main(Args) ->
ok = io:setopts([{encoding, unicode}]),
io:format("Escript received the args: ~tp~n", [Args]).
-Craig
More information about the erlang-questions
mailing list