mailRe: r2540 - in /branches/warning: errors.py generic_fns/pdb.py relax


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by Chris MacRaild on August 31, 2006 - 16:01:
On Thu, 2006-08-31 at 23:29 +1000, Edward d'Auvergne wrote:
On 8/31/06, Chris MacRaild wrote:
On Wed, 2006-08-30 at 15:50 +1000, Edward d'Auvergne wrote:
Thanks, these changes look very promising.  A few things need to be
discussed and tested before merging this code back into the main 1.2
line.  I have a few points below interspersed between your code.
Firstly I have committed a change which affects the order of
initialisation so that the RelaxErrors and RelaxWarnings are
initialised after the pedantic flag but before the command line
parsing (see 
https://mail.gna.org/public/relax-commits/2006-08/msg00014.html,
Message-id: <E1GIIBN-00026c-Ga@xxxxxxxxxxxxxxxxxx>).  This removes the
missing AllRelaxErrors error.


Testing this again in preparation for the merge shows that this change
has broken the pedantic functionality. The pedantic flag must be
correctly set before RelaxWarnings is initialised. Probably the best fix
will be to initialise RelaxErrors first, before parsing comand line
arguments, then finally initialise the warnings.

Maybe the RelaxParser.error() function (in the file 'relax') needs to
be reconsidered to remove the dependence on the RelaxErrors.  Then the
order won't matter.  I think the only reason for the entire
RelaxParser code is to print 'RelaxError: ' in front of all the parser
errors.  This could be done without the try statement, just add the
text to the front of the message, write it to stderr, then sys.exit().


It makes sense to me for parser errors to be RelaxErrors - this way they
can be appropriately caught by higher-level code if necessary. I assumed
this was the purpose of the RelaxParser class, but looking closer, I see
it doesn't do that. I propose replacing the try clause in
RelaxParser.error with a simple 'raise RelaxError, message' (the
sys.exit() then becomes redundant). A specific exception class might
also be a good idea (RelaxOptionsError, eg). The order of operations I
proposed above is required to initialise both the errors and the
warnings appropriately.

Chris


Edward





Related Messages


Powered by MHonArc, Updated Thu Aug 31 16:21:29 2006