changeset 49947:5392bf258049

hooklib: force an exception wrapped by errors.Abort to bytestr Flagged by PyCharm and pytype.
author Matt Harbison <matt_harbison@yahoo.com>
date Fri, 06 Jan 2023 00:05:14 -0500
parents 5f006f789373
children 2ac60a71c240
files hgext/hooklib/changeset_obsoleted.py hgext/hooklib/changeset_published.py
diffstat 2 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/hooklib/changeset_obsoleted.py	Fri Jan 06 00:04:46 2023 -0500
+++ b/hgext/hooklib/changeset_obsoleted.py	Fri Jan 06 00:05:14 2023 -0500
@@ -32,7 +32,10 @@
     pycompat,
     registrar,
 )
-from mercurial.utils import dateutil
+from mercurial.utils import (
+    dateutil,
+    stringutil,
+)
 from .. import notify
 
 configtable = {}
@@ -98,7 +101,7 @@
     try:
         msg = mail.parsebytes(data)
     except emailerrors.MessageParseError as inst:
-        raise error.Abort(inst)
+        raise error.Abort(stringutil.forcebytestr(inst))
 
     msg['In-reply-to'] = notify.messageid(ctx, domain, messageidseed)
     msg['Message-Id'] = notify.messageid(
--- a/hgext/hooklib/changeset_published.py	Fri Jan 06 00:04:46 2023 -0500
+++ b/hgext/hooklib/changeset_published.py	Fri Jan 06 00:05:14 2023 -0500
@@ -31,7 +31,10 @@
     pycompat,
     registrar,
 )
-from mercurial.utils import dateutil
+from mercurial.utils import (
+    dateutil,
+    stringutil,
+)
 from .. import notify
 
 configtable = {}
@@ -97,7 +100,7 @@
     try:
         msg = mail.parsebytes(data)
     except emailerrors.MessageParseError as inst:
-        raise error.Abort(inst)
+        raise error.Abort(stringutil.forcebytestr(inst))
 
     msg['In-reply-to'] = notify.messageid(ctx, domain, messageidseed)
     msg['Message-Id'] = notify.messageid(