octave-maintainers
[Top][All Lists]
Advanced

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

Re: [Changeset] new bzip2 function


From: John W. Eaton
Subject: Re: [Changeset] new bzip2 function
Date: Mon, 5 Jan 2009 12:10:18 -0500

On  1-Jan-2009, Thorsten Meyer wrote:

| John W. Eaton wrote:
| > +      error (sprintf("%s: extension has to be a string with finite length",
| > +                     commandname));
| >
| > There's no need to use sprintf here since error already understands
| > format strings.  So you should write
| >
| >   error ("%s: extension has to be a string with finite length", 
commandname);
| >   
| Thanks for the hint.
| 
| Attached, you will find a little patch which fixes the error messages in
| __xzip__ and adds a few tests of the error handling.

| diff -r 628b6973b9fe -r 8f1edcf346b6 scripts/miscellaneous/__xzip__.m
| --- a/scripts/miscellaneous/__xzip__.m        Mon Dec 29 11:21:42 2008 +0100
| +++ b/scripts/miscellaneous/__xzip__.m        Thu Jan 01 11:24:18 2009 +0100
| @@ -34,8 +34,7 @@
|  
|    if (nargin == 4 || nargin == 5)
|      if (! ischar (extension) || length (extension) == 0)
| -      error (sprintf("%s: extension has to be a string with finite length",
| -                     commandname));
| +      error ("__xzip__: extension has to be a string with finite length");

Is it possible for these messages to be triggered by calling the bzip2
or gzip functions incorrectly?  If so, then the __xzip__ in the
messages won't help users much, and you should probably use the name
of the calling function in the error message.

Or, if these messages can only happen if __xzip__ itself is called
improperly, then I suppose it is OK to leave them as they are, or it
would also be OK to omit the checks entirely, since this is an
internal function.

jwe


reply via email to

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