Mercurial > public > mercurial-scm > hg
comparison mercurial/wireproto.py @ 36840:ef68493d652b
wireproto: raise ProgrammingError instead of Abort
This isn't a user-facing error and can only be caused by bad
Python code.
Thanks to Yuya for spotting this.
Differential Revision: https://phab.mercurial-scm.org/D2777
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 10 Mar 2018 10:27:56 -0800 |
parents | 5bc7ff103081 |
children | 4901d1e22b27 |
comparison
equal
deleted
inserted
replaced
36839:5b9ae9eca94a | 36840:ef68493d652b |
---|---|
702 if v['version'] == 1} | 702 if v['version'] == 1} |
703 elif transportpolicy == POLICY_V2_ONLY: | 703 elif transportpolicy == POLICY_V2_ONLY: |
704 transports = {k for k, v in wireprototypes.TRANSPORTS.items() | 704 transports = {k for k, v in wireprototypes.TRANSPORTS.items() |
705 if v['version'] == 2} | 705 if v['version'] == 2} |
706 else: | 706 else: |
707 raise error.Abort(_('invalid transport policy value: %s') % | 707 raise error.ProgrammingError('invalid transport policy value: %s' % |
708 transportpolicy) | 708 transportpolicy) |
709 | 709 |
710 if permission not in ('push', 'pull'): | 710 if permission not in ('push', 'pull'): |
711 raise error.Abort(_('invalid wire protocol permission; got %s; ' | 711 raise error.ProgrammingError('invalid wire protocol permission; ' |
712 'expected "push" or "pull"') % permission) | 712 'got %s; expected "push" or "pull"' % |
713 permission) | |
713 | 714 |
714 def register(func): | 715 def register(func): |
715 commands[name] = commandentry(func, args=args, transports=transports, | 716 commands[name] = commandentry(func, args=args, transports=transports, |
716 permission=permission) | 717 permission=permission) |
717 return func | 718 return func |