> > +def exception2msg(e):
> > +    try:
> > +        return str(e)
> > +    except UnicodeEncodeError:
> > +        return unicode(e)

> There's multiple ways that this could fail and still raise an exception.

I've tried various ways to break this and failed.  After changing locales
forth and back I'm now no longer able to raise IOError with unicode args.
They are locale-encoded so str(e) never fails, strange...

It might be wise to change the unicode path to return
unicode(e).encode('utf8'), so we return the same types.

> In addition, the code that uses exception2msg could also start throwing
> exceptions depending on what it's getting back from this method.

There's no i18n in urlgrabber, no unicode literals.. Using encoded 
strings should work well, IMO.  Upper layers (yum) re-convert 
exceptions to unicode.
_______________________________________________
Yum-devel mailing list
Yum-devel@lists.baseurl.org
http://lists.baseurl.org/mailman/listinfo/yum-devel

Reply via email to