comparison mercurial/dispatch.py @ 14096:dea93484cf9f

dispatch: handle IndexErrors
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Sun, 01 May 2011 11:01:57 +0200
parents 97ed99d1f419
children e4ab5ae193f2
comparison
equal deleted inserted replaced
14095:877390020477 14096:dea93484cf9f
131 if hasattr(inst, "code"): 131 if hasattr(inst, "code"):
132 ui.warn(_("abort: %s\n") % inst) 132 ui.warn(_("abort: %s\n") % inst)
133 elif hasattr(inst, "reason"): 133 elif hasattr(inst, "reason"):
134 try: # usually it is in the form (errno, strerror) 134 try: # usually it is in the form (errno, strerror)
135 reason = inst.reason.args[1] 135 reason = inst.reason.args[1]
136 except AttributeError: # it might be anything, for example a string 136 except (AttributeError, IndexError):
137 # it might be anything, for example a string
137 reason = inst.reason 138 reason = inst.reason
138 ui.warn(_("abort: error: %s\n") % reason) 139 ui.warn(_("abort: error: %s\n") % reason)
139 elif hasattr(inst, "args") and inst.args[0] == errno.EPIPE: 140 elif hasattr(inst, "args") and inst.args[0] == errno.EPIPE:
140 if ui.debugflag: 141 if ui.debugflag:
141 ui.warn(_("broken pipe\n")) 142 ui.warn(_("broken pipe\n"))