---
urlgrabber/grabber.py | 6 ++++++
urlgrabber/mirror.py | 3 ++-
2 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/urlgrabber/grabber.py b/urlgrabber/grabber.py
index 01218b0..0e20cee 100644
--- a/urlgrabber/grabber.py
+++ b/urlgrabber/grabber.py
@@ -621,6 +621,12 @@ def _to_utf8(obj, errors='replace'):
obj = obj.encode('utf-8', errors)
return obj
+def exception2msg(e):
+ try:
+ return str(e)
+ except UnicodeEncodeError:
+ return unicode(e)
+
########################################################################
# END UTILITY FUNCTIONS
########################################################################
diff --git a/urlgrabber/mirror.py b/urlgrabber/mirror.py
index b17be17..eeeb5d0 100644
--- a/urlgrabber/mirror.py
+++ b/urlgrabber/mirror.py
@@ -96,6 +96,7 @@ import thread # needed for locking to make this threadsafe
from grabber import URLGrabError, CallbackObject, DEBUG, _to_utf8
from grabber import _run_callback, _do_raise
+from grabber import exception2msg
def _(st):
return st
@@ -411,7 +412,7 @@ class MirrorGroup:
return func_ref( *(fullurl,), opts=opts, **kw )
except URLGrabError, e:
if DEBUG: DEBUG.info('MIRROR: failed')
- gr.errors.append((fullurl, str(e)))
+ gr.errors.append((fullurl, exception2msg(e)))
obj = CallbackObject()
obj.exception = e
obj.mirror = mirrorchoice['mirror']
--
1.7.4.4
_______________________________________________
Yum-devel mailing list
[email protected]
http://lists.baseurl.org/mailman/listinfo/yum-devel