Skip to content

Commit

Permalink
move consul transport errors to class
Browse files Browse the repository at this point in the history
  • Loading branch information
pawl committed Dec 22, 2021
1 parent 46462b9 commit b6591e1
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions kombu/transport/consul.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,24 +276,25 @@ class Transport(virtual.Transport):
driver_type = 'consul'
driver_name = 'consul'

def __init__(self, *args, **kwargs):
if consul is None:
raise ImportError('Missing python-consul library')

super().__init__(*args, **kwargs)

self.connection_errors = (
if consul:
connection_errors = (
virtual.Transport.connection_errors + (
consul.ConsulException, consul.base.ConsulException
)
)

self.channel_errors = (
channel_errors = (
virtual.Transport.channel_errors + (
consul.ConsulException, consul.base.ConsulException
)
)

def __init__(self, *args, **kwargs):
if consul is None:
raise ImportError('Missing python-consul library')

super().__init__(*args, **kwargs)

def verify_connection(self, connection):
port = connection.client.port or self.default_port
host = connection.client.hostname or DEFAULT_HOST
Expand Down

0 comments on commit b6591e1

Please sign in to comment.