Patchwork D7463: wireprotov1server: capture Abort type before accessing the `hint` attribute

login
register
mail settings
Submitter phabricator
Date Nov. 21, 2019, 3:27 a.m.
Message ID <differential-rev-PHID-DREV-spsb7akbsgwq2bfp7y46-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/43377/
State Superseded
Headers show

Comments

phabricator - Nov. 21, 2019, 3:27 a.m.
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Although the previous code worked, pytypes complained because `exc` is caught
  above as `BundleValueError, Abort, PushRaced`, and the other two don't have this
  attribute.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7463

AFFECTED FILES
  mercurial/wireprotov1server.py

CHANGE DETAILS




To: mharbison72, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/wireprotov1server.py b/mercurial/wireprotov1server.py
--- a/mercurial/wireprotov1server.py
+++ b/mercurial/wireprotov1server.py
@@ -679,7 +679,7 @@ 
             if not getattr(exc, 'duringunbundle2', False):
                 try:
                     raise
-                except error.Abort:
+                except error.Abort as exc:
                     # The old code we moved used procutil.stderr directly.
                     # We did not change it to minimise code change.
                     # This need to be moved to something proper.