From 62de2fb6ba782854f2258347e010d201fdb0e338 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20Ma=C5=9Blanka?= <piotr.maslanka@henrietta.com.pl>
Date: Sat, 4 Jan 2020 19:20:48 +0100
Subject: [PATCH] exceptions will now display correctly

---
 coolamqp/exceptions.py   | 2 +-
 tests/test_exceptions.py | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/coolamqp/exceptions.py b/coolamqp/exceptions.py
index 34f5404..fcfcbc6 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 1e84b0e..08f81a9 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))
-- 
GitLab