comparison mercurial/commands.py @ 3564:eda9e7c9300d

New UnexpectedOutput exception to catch server errors in localrepo.stream_in If the unexpected is a string, the empty string will be mentioned, and long strings are cut to at most 400 chars.
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 27 Oct 2006 18:17:12 +0200
parents db946221a58a
children 23f7d9621783
comparison
equal deleted inserted replaced
3563:db946221a58a 3564:eda9e7c9300d
3520 except OSError, inst: 3520 except OSError, inst:
3521 if getattr(inst, "filename", None): 3521 if getattr(inst, "filename", None):
3522 u.warn(_("abort: %s: %s\n") % (inst.strerror, inst.filename)) 3522 u.warn(_("abort: %s: %s\n") % (inst.strerror, inst.filename))
3523 else: 3523 else:
3524 u.warn(_("abort: %s\n") % inst.strerror) 3524 u.warn(_("abort: %s\n") % inst.strerror)
3525 except util.UnexpectedOutput, inst:
3526 u.warn(_("abort: %s") % inst[0])
3527 if not isinstance(inst[1], basestring):
3528 u.warn(" %r\n" % (inst[1],))
3529 elif not inst[1]:
3530 u.warn(_(" empty string\n"))
3531 else:
3532 u.warn("\n%r%s\n" %
3533 (inst[1][:400], len(inst[1]) > 400 and '...' or ''))
3525 except util.Abort, inst: 3534 except util.Abort, inst:
3526 u.warn(_("abort: %s\n") % inst) 3535 u.warn(_("abort: %s\n") % inst)
3527 except TypeError, inst: 3536 except TypeError, inst:
3528 # was this an argument error? 3537 # was this an argument error?
3529 tb = traceback.extract_tb(sys.exc_info()[2]) 3538 tb = traceback.extract_tb(sys.exc_info()[2])