Author r.david.murray
Recipients r.david.murray, rubenlm, tarek
Date 2010-04-29.13:50:19
SpamBayes Score 9.51477e-05
Marked as misclassified No
Message-id <1272549022.03.0.968035490698.issue8523@psf.upfronthosting.co.za>
In-reply-to
Content
Well, I don't think removing the current onerror support is a viable option for backward compatibility reasons, so we might as well fix it.  

I agree that (2) sounds tricky to get reliably right, while I don't see how (1) is an improvement over onerror.  It seems to me that the list is either really a tree, in which case the error handler has to reimplement most of rmtree's logic in order to do a recover, or it is a list of error filepath pairs, in which case the error handler would be in most cases simply be iterating over the list and branching based on the error flag...which is no different than what onerror allows, but onerror doesn't need the loop code.  Actually, it's less capable than what onerror allows, since if onerror successfully removes a problem file, rmtree will remove the directory, whereas a (1) style handler will have to have its own error logic for dealing with the successive removals (and the (1) style list will have to be guaranteed to be sorted in the correct bottom up order).

I guess I don't see how knowing the global state (which in this case appears to mean the total list of files and directories where removal failed) is useful very often, if ever.  It feels like it is a more complicated API that provides little benefit.  Do you have some use cases in mind, Tarek?

On the other hand, it seems to me that a nice improvement to onerror would be for it to accept an object, and call an error-case-specific method for each different error case, perhaps even checking for method existence first and doing its normal error handling for that case if the method isn't defined.
History
Date User Action Args
2010-04-29 13:50:22r.david.murraysetrecipients: + r.david.murray, tarek, rubenlm
2010-04-29 13:50:22r.david.murraysetmessageid: <1272549022.03.0.968035490698.issue8523@psf.upfronthosting.co.za>
2010-04-29 13:50:19r.david.murraylinkissue8523 messages
2010-04-29 13:50:19r.david.murraycreate