Erlang/OTP Forums

Author Message

<  Erlang  ~  Cryptic error messages

forestial
Posted: Wed Mar 26, 2008 7:04 pm Reply with quote
Joined: 26 Mar 2008 Posts: 4
I am running 1:11b5 on Ubuntu (that's the latest version in Ubuntu's package management system, though I see there is a 1:12 out now).

I am getting really cryptic messages in response to any error that I make.

For example:

(ping@wirwin_ub41)1> M = 5.
5
(ping@wirwin_ub41)2> M = 6.

=ERROR REPORT==== 26-Mar-2008::14:01:34 ===
Error in process <0.37.0> on node 'ping@wirwin_ub41' with exit value: {{badmatch,6},[{erl_eval,expr,3}]}

** exited: {{badmatch,6},[{erl_eval,expr,3}]} **

Huh?

... whereas from reading the Getting Started with Erlang tutorial, I was expecting a message like:

** exception error: no match of right hand side value 6

Am I doing something wrong, or is this the way it is in the version I have?

(For my second day running Erlang, error messages like this are not exactly helping my learning curve Smile
View user's profile Send private message
forestial
Posted: Thu Mar 27, 2008 4:34 pm Reply with quote
Joined: 26 Mar 2008 Posts: 4
Got a reply when I posted this question on the mailing list: you need version 1:12b or later to get the less-obscure error messages.
View user's profile Send private message
dsmith
Posted: Thu Mar 27, 2008 11:39 pm Reply with quote
User Joined: 08 Aug 2007 Posts: 41 Location: Toronto
Yes the shell in 12b-1 now makes some of the messages prettier if they are thrown to the shell. The tuple that's thrown, however, hasn't change.

If you catch the error, you can see that the throw term is {badmatch, 6}:
Code:

Eshell V5.6.1  (abort with ^G)
1> try
1> M=5, M=6
1> catch
1> T:E -> {T, E}
1> end.
{error,{badmatch,6}}


If the shell doesn't know about the error, it will not produce an english message:
Code:

Eshell V5.6.1  (abort with ^G)
1> erlang:error({some_error, 13}).
** exception error: {some_error,13}


I'm not sure if I would describe the 11b-1 messages as cryptic, but it does provide a lot of extra information, which is normally not useful in the shell.
View user's profile Send private message

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum