Mercurial > hg
changeset 4010:e282448d68f1
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
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Thu, 28 Dec 2006 01:14:12 +0100 |
parents | 86098ec4b77a |
children | 15955d84bc68 |
files | mercurial/commands.py |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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"))