Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 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 | 54fa628b8c78 |
comparison
equal
deleted
inserted
replaced
4009:86098ec4b77a | 4010:e282448d68f1 |
---|---|
3275 raise | 3275 raise |
3276 except IOError, inst: | 3276 except IOError, inst: |
3277 if hasattr(inst, "code"): | 3277 if hasattr(inst, "code"): |
3278 u.warn(_("abort: %s\n") % inst) | 3278 u.warn(_("abort: %s\n") % inst) |
3279 elif hasattr(inst, "reason"): | 3279 elif hasattr(inst, "reason"): |
3280 u.warn(_("abort: error: %s\n") % inst.reason[1]) | 3280 try: # usually it is in the form (errno, strerror) |
3281 reason = inst.reason.args[1] | |
3282 except: # it might be anything, for example a string | |
3283 reason = inst.reason | |
3284 u.warn(_("abort: error: %s\n") % reason) | |
3281 elif hasattr(inst, "args") and inst[0] == errno.EPIPE: | 3285 elif hasattr(inst, "args") and inst[0] == errno.EPIPE: |
3282 if u.debugflag: | 3286 if u.debugflag: |
3283 u.warn(_("broken pipe\n")) | 3287 u.warn(_("broken pipe\n")) |
3284 elif getattr(inst, "strerror", None): | 3288 elif getattr(inst, "strerror", None): |
3285 if getattr(inst, "filename", None): | 3289 if getattr(inst, "filename", None): |