style for error and warning messages

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

style for error and warning messages

John W. Eaton
Administrator
Currently, most of Octave uses a style for error and warning messages
that is something like this:

   warning ("nchoosek: possible loss of precision");

but now that error and warning messages display stack trace information
by default, having the name of the function as a prefix for the message
is redundant.  Does anyone object to removing the function name as a
prefix to error and warning messages?

jwe

Reply | Threaded
Open this post in threaded view
|

Re: style for error and warning messages

Mike Miller
On Thu, Dec 18, 2014 at 11:45:59 -0500, John W. Eaton wrote:
> Currently, most of Octave uses a style for error and warning messages that
> is something like this:
>
>   warning ("nchoosek: possible loss of precision");
>
> but now that error and warning messages display stack trace information by
> default, having the name of the function as a prefix for the message is
> redundant.  Does anyone object to removing the function name as a prefix to
> error and warning messages?

I think it works better the way it is now. IMHO it's still very
helpful to see the function name in the primary message line. The rest
of the stack trace is useful, but can probably be safely ignored by
novice users.

It seems to me there may also be a lot of code, both within and
outside of Octave, that relies on the current behavior. For example,
using catch or lasterr and redisplaying the message alone, or even
searching for the function name in the error string. Or possibly many
%!error validation tests that are pattern matching for the function
name.

There is also the trailing newline feature of the error function,
which is used throughout Octave and OF packages to inhibit the default
stack trace. In that case there would be no clue where the error is
coming from.

--
mike

Reply | Threaded
Open this post in threaded view
|

Re: style for error and warning messages

Philip Nienhuis
In reply to this post by John W. Eaton
John W. Eaton wrote
Currently, most of Octave uses a style for error and warning messages
that is something like this:

   warning ("nchoosek: possible loss of precision");

but now that error and warning messages display stack trace information
by default, having the name of the function as a prefix for the message
is redundant.  Does anyone object to removing the function name as a
prefix to error and warning messages?
There are several cases where a stack trace looks redundant to me as the warning or error message itself provides sufficient info; a stack trace may just be distracting then.
Examples: file not found errors, or wrong or too few input parameters.

I didn't know that the default is full info in all cases, but OK Matlab does the same AFAIK.

If the default setting is overridden and a warning or error message pops up (w/o function name) I suppose there's no more clue where it came from?

Philip
Reply | Threaded
Open this post in threaded view
|

Re: style for error and warning messages

Rik-4
In reply to this post by John W. Eaton
On 12/18/2014 09:00 AM, [hidden email] wrote:
Subject:
style for error and warning messages
From:
"John W. Eaton" [hidden email]
Date:
12/18/2014 08:45 AM
To:
[hidden email]
List-Post:
[hidden email]
Content-Transfer-Encoding:
7bit
Precedence:
list
MIME-Version:
1.0
Message-ID:
[hidden email]
Content-Type:
text/plain; charset=utf-8; format=flowed
Message:
3

Currently, most of Octave uses a style for error and warning messages that is something like this:

  warning ("nchoosek: possible loss of precision");

but now that error and warning messages display stack trace information by default, having the name of the function as a prefix for the message is redundant.  Does anyone object to removing the function name as a prefix to error and warning messages?


Seems reasonable.

--Rik