Improve exception handling by using unicode.

This commit is contained in:
Bastian Kleineidam 2012-09-21 14:29:20 +02:00
parent f46889a4af
commit 0941f6ff02

View file

@ -583,10 +583,10 @@ class UrlBase (object):
not value:
# EBADF occurs when operating on an already socket
self.caching = False
errmsg = etype.__name__
if str(value):
errmsg = unicode(etype.__name__)
if unicode(value):
# use Exception class name
errmsg += ": %s" % str(value)
errmsg += u": %s" % unicode(value)
# limit length to 240
return strformat.limit(errmsg, length=240)