inst.reason isn't alway in the form (errno, strerror)
urllib2.urlopen("foobar://foo") is an example
where inst.reason is a string
fix issue383
--- a/mercurial/commands.py Tue Dec 26 21:59:01 2006 +0100
+++ b/mercurial/commands.py Thu Dec 28 01:14:12 2006 +0100
@@ -3277,7 +3277,11 @@
if hasattr(inst, "code"):
u.warn(_("abort: %s\n") % inst)
elif hasattr(inst, "reason"):
- u.warn(_("abort: error: %s\n") % inst.reason[1])
+ try: # usually it is in the form (errno, strerror)
+ reason = inst.reason.args[1]
+ except: # it might be anything, for example a string
+ reason = inst.reason
+ u.warn(_("abort: error: %s\n") % reason)
elif hasattr(inst, "args") and inst[0] == errno.EPIPE:
if u.debugflag:
u.warn(_("broken pipe\n"))