Patchwork D2342: wireproto: fix lingering str(exception) with util.forcebytestr(exception)

login
register
mail settings
Submitter phabricator
Date Feb. 19, 2018, 2:06 a.m.
Message ID <6fc0bdbff1b68aebbb6509263e2f5b3d@localhost.localdomain>
Download mbox | patch
Permalink /patch/28139/
State Not Applicable
Headers show

Comments

phabricator - Feb. 19, 2018, 2:06 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG803fca7fa088: wireproto: fix lingering str(exception) with util.forcebytestr(exception) (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2342?vs=5899&id=5910

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

AFFECTED FILES
  mercurial/wireproto.py

CHANGE DETAILS




To: durin42, #hg-reviewers, indygreg
Cc: mercurial-devel

Patch

diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py
--- a/mercurial/wireproto.py
+++ b/mercurial/wireproto.py
@@ -927,7 +927,7 @@ 
         r = c.hex()
         success = 1
     except Exception as inst:
-        r = str(inst)
+        r = util.forcebytestr(inst)
         success = 0
     return bytesresponse('%d %s\n' % (success, r))
 
@@ -1055,12 +1055,13 @@ 
                 if exc.params:
                     errpart.addparam('params', '\0'.join(exc.params))
             except error.Abort as exc:
-                manargs = [('message', str(exc))]
+                manargs = [('message', util.forcebytestr(exc))]
                 advargs = []
                 if exc.hint is not None:
                     advargs.append(('hint', exc.hint))
                 bundler.addpart(bundle2.bundlepart('error:abort',
                                                    manargs, advargs))
             except error.PushRaced as exc:
-                bundler.newpart('error:pushraced', [('message', str(exc))])
+                bundler.newpart('error:pushraced',
+                                [('message', util.forcebytestr(exc))])
             return streamres_legacy(gen=bundler.getchunks())