From 0ead20f6a41437edb61a30272bae71207d21efbb Mon Sep 17 00:00:00 2001 From: Israel Date: Tue, 23 May 2023 12:05:53 -0300 Subject: [PATCH] Remove `__str__` method from `PatroniException`. (#2688) The `__str__` method was calling `repr` over the exception message, which was causing `print` calls to render not so nicely, e.g.: ``` $ patronictl show-config Error: 'Can not find suitable configuration of distributed configuration store\nAvailable implementations: consul, etcd, etcd3, exhibitor, kubernetes, raft, zookeeper' ``` By removing the `__str__` method we get a better rendering, e.g.: ``` $ patronictl show-config Error: Can not find suitable configuration of distributed configuration store Available implementations: consul, etcd, etcd3, exhibitor, kubernetes, raft, zookeeper ``` References: PAT-107. Signed-off-by: Israel Barth Rubio --- patroni/exceptions.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/patroni/exceptions.py b/patroni/exceptions.py index 88edfe07..f8bf6df1 100644 --- a/patroni/exceptions.py +++ b/patroni/exceptions.py @@ -8,13 +8,6 @@ class PatroniException(Exception): def __init__(self, value: Any) -> None: self.value = value - def __str__(self) -> str: - """ - >>> str(PatroniException('foo')) - "'foo'" - """ - return repr(self.value) - class PatroniFatalException(PatroniException): pass