-
Notifications
You must be signed in to change notification settings - Fork 99
Expand file tree
/
Copy pathexceptions.py
More file actions
38 lines (23 loc) · 806 Bytes
/
exceptions.py
File metadata and controls
38 lines (23 loc) · 806 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from confluent_kafka import KafkaError
from quixstreams.exceptions import QuixException
class BaseKafkaException(QuixException):
def __init__(self, error: KafkaError):
self.error = error
@property
def code(self) -> int:
return self.error.code()
@property
def description(self):
return self.error.str()
def __str__(self):
return (
f"<{self.__class__.__name__} "
f'code="{self.code}" '
f'description="{self.description}">'
)
def __repr__(self):
return str(self)
class KafkaConsumerException(BaseKafkaException): ...
class KafkaProducerDeliveryError(BaseKafkaException): ...
class InvalidProducerConfigError(QuixException): ...
class KafkaBrokerUnavailableError(QuixException): ...