diff --git a/coolamqp/exceptions.py b/coolamqp/exceptions.py index 34f5404c5dd1229363953b7ec4ea2d0e2b8e10bb..fcfcbc677c388da638167454db2cdff31b01d52e 100644 --- a/coolamqp/exceptions.py +++ b/coolamqp/exceptions.py @@ -35,7 +35,7 @@ class AMQPError(CoolAMQPError): else: reply_text = self.reply_text - if isinstance(self.reply_text, bytes): + if isinstance(reply_text, bytes): reply_text = self.reply_text.decode('utf8') return reply_text diff --git a/tests/test_exceptions.py b/tests/test_exceptions.py index 1e84b0e2258e8b1050d2b367ae30840f9e6b0e2a..08f81a9834a6ed1b3f5941e7d875ebdd583c2ade 100644 --- a/tests/test_exceptions.py +++ b/tests/test_exceptions.py @@ -18,3 +18,7 @@ class TestExcs(unittest.TestCase): e = AMQPError(100, memoryview(u'wtf'.encode('utf8')), 0, 0) self.assertIn('wtf', str(e)) self.assertIn('wtf', repr(e)) + + e = AMQPError(100, u'wtf'.encode('utf8'), 0, 0) + self.assertIn('wtf', str(e)) + self.assertIn('wtf', repr(e))