##// END OF EJS Templates
dispatch: add inline comment about possible IOError subtypes...
Yuya Nishihara -
r41464:b5169e79 default
parent child Browse files
Show More
@@ -232,9 +232,9 b' def callcatch(ui, func):'
232 elif m in "zlib".split():
232 elif m in "zlib".split():
233 ui.error(_("(is your Python install correct?)\n"))
233 ui.error(_("(is your Python install correct?)\n"))
234 except IOError as inst:
234 except IOError as inst:
235 if util.safehasattr(inst, "code"):
235 if util.safehasattr(inst, "code"): # HTTPError
236 ui.error(_("abort: %s\n") % stringutil.forcebytestr(inst))
236 ui.error(_("abort: %s\n") % stringutil.forcebytestr(inst))
237 elif util.safehasattr(inst, "reason"):
237 elif util.safehasattr(inst, "reason"): # URLError or SSLError
238 try: # usually it is in the form (errno, strerror)
238 try: # usually it is in the form (errno, strerror)
239 reason = inst.reason.args[1]
239 reason = inst.reason.args[1]
240 except (AttributeError, IndexError):
240 except (AttributeError, IndexError):
@@ -247,14 +247,14 b' def callcatch(ui, func):'
247 elif (util.safehasattr(inst, "args")
247 elif (util.safehasattr(inst, "args")
248 and inst.args and inst.args[0] == errno.EPIPE):
248 and inst.args and inst.args[0] == errno.EPIPE):
249 pass
249 pass
250 elif getattr(inst, "strerror", None):
250 elif getattr(inst, "strerror", None): # common IOError
251 if getattr(inst, "filename", None):
251 if getattr(inst, "filename", None):
252 ui.error(_("abort: %s: %s\n") % (
252 ui.error(_("abort: %s: %s\n") % (
253 encoding.strtolocal(inst.strerror),
253 encoding.strtolocal(inst.strerror),
254 stringutil.forcebytestr(inst.filename)))
254 stringutil.forcebytestr(inst.filename)))
255 else:
255 else:
256 ui.error(_("abort: %s\n") % encoding.strtolocal(inst.strerror))
256 ui.error(_("abort: %s\n") % encoding.strtolocal(inst.strerror))
257 else:
257 else: # suspicious IOError
258 raise
258 raise
259 except OSError as inst:
259 except OSError as inst:
260 if getattr(inst, "filename", None) is not None:
260 if getattr(inst, "filename", None) is not None:
General Comments 0
You need to be logged in to leave comments. Login now