Mercurial > public > mercurial-scm > hg
comparison mercurial/wireproto.py @ 25493:d8e7b0781ad7
bundle2: convey PushkeyFailed error over the wire
We add a way to convey the precise exception. This will allow better error
message on the server.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Wed, 10 Jun 2015 13:10:53 -0400 |
parents | 30ab130af221 |
children | 328739ea70c3 |
comparison
equal
deleted
inserted
replaced
25492:219b8ab31220 | 25493:d8e7b0781ad7 |
---|---|
817 | 817 |
818 bundler = bundle2.bundle20(repo.ui) | 818 bundler = bundle2.bundle20(repo.ui) |
819 for out in getattr(exc, '_bundle2salvagedoutput', ()): | 819 for out in getattr(exc, '_bundle2salvagedoutput', ()): |
820 bundler.addpart(out) | 820 bundler.addpart(out) |
821 try: | 821 try: |
822 raise | 822 try: |
823 raise | |
824 except error.PushkeyFailed, exc: | |
825 # check client caps | |
826 remotecaps = getattr(exc, '_replycaps', None) | |
827 if (remotecaps is not None | |
828 and 'pushkey' not in remotecaps.get('error', ())): | |
829 # no support remote side, fallback to Abort handler. | |
830 raise | |
831 part = bundler.newpart('error:pushkey') | |
832 part.addparam('in-reply-to', exc.partid) | |
833 if exc.namespace is not None: | |
834 part.addparam('namespace', exc.namespace, mandatory=False) | |
835 if exc.key is not None: | |
836 part.addparam('key', exc.key, mandatory=False) | |
837 if exc.new is not None: | |
838 part.addparam('new', exc.new, mandatory=False) | |
839 if exc.old is not None: | |
840 part.addparam('old', exc.old, mandatory=False) | |
841 if exc.ret is not None: | |
842 part.addparam('ret', exc.ret, mandatory=False) | |
823 except error.BundleValueError, exc: | 843 except error.BundleValueError, exc: |
824 errpart = bundler.newpart('error:unsupportedcontent') | 844 errpart = bundler.newpart('error:unsupportedcontent') |
825 if exc.parttype is not None: | 845 if exc.parttype is not None: |
826 errpart.addparam('parttype', exc.parttype) | 846 errpart.addparam('parttype', exc.parttype) |
827 if exc.params: | 847 if exc.params: |