octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Stupid question on error messages


From: John W. Eaton
Subject: Stupid question on error messages
Date: Sun, 3 Jun 2007 12:01:58 -0400

On  3-Jun-2007, Søren Hauberg wrote:

| Hi,
|    In general I really like the traceback information provided by Octave 
| when an error occurs, but I do find it a bit to verbose. As an example 
| consider the following function
| 
| function f(a)
|    for i = 1:10
|      if (a == i)
|        svd("bad argument")
|      endif
|    endfor
| endfunction
| 
| If I call this with 'f(y)' I get the following error:
| 
| error: svd: wrong type argument `string'
| error: evaluating if command near line 3, column 5
| error: evaluating for command near line 2, column 3
| error: called from `f' in file `/home/sh/f.m'
| 
| Now, I'm wondering how the second and third line of the error message 
| helps me? In general I don't care about which if-statement contains the 
| body that caused the error. Instead I care about the line of code that 
| contains the error. So instead I'd prefer the error message to be 
| something like
| 
| error: svd: wrong type argument `string'
| error: called from `f' in file `/home/sh/f.m' at line 4
| 
| As you guys in general are smarter than me, I assume there is a very 
| good reason for the current error message. I was just wondering what 
| that reason is...

It's just the next statement up in the parse tree.  But I think you
are right that the location of the beginning of the enclosing
for/while/if/etc. block doesn't really add much information.  So we
could consider dropping that message.  Patches, anyone?

jwe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]