[Yum-devel] rethinking RepoError

Paul Nasrat pnasrat at redhat.com
Fri Oct 13 14:53:12 UTC 2006


On Tue, 2006-09-26 at 14:28 -0400, Chris Lumens wrote:
> I've been looking at error handling again, and have decided that
> RepoError isn't really all that useful.  My particular complaint is that
> it's too easy for RepoError to disguise the real cause of the exception.
> setup in yumRepo.py shows my problem perfectly.

You haven't really had any replies to this.  I agree it'd be nice to
have some richer error handling in parts to expose to API users the root
cause.

> The first fix that sprang to mind was that RepoError could behave like
> the SML/NJ Io exception.  One of the members of an Io exception
> structure is another exception, with the name "cause".  This gives you
> the complete details to the real problem.  If RepoError had the
> URLGrabError packaged up inside it, callers could still just catch the
> RepoError and if they cared to, inspect the cause to log it or print a
> descriptive error message or whatever.  Otherwise, the exception behaves
> like it always has.

This sounds reasonable to me so you'd have new RepoError
__init__(origerror=None) and potentially callers up the stack can check
that.

Would you also override the string error to call the root cause for
pretty printing I guess.
 
Paul




More information about the Yum-devel mailing list