Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/confluent_kafka/cimpl.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ class KafkaError:
_WAIT_COORD: int
def __init__(
self,
code: int,
error: int,
reason: Optional[str] = None,
fatal: bool = False,
retriable: bool = False,
Expand Down
8 changes: 8 additions & 0 deletions tests/test_kafka_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ def test_kafkaError_custom_msg():
assert not err.txn_requires_abort()


def test_kafkaError_init_keyword_matches_runtime_signature():
err = KafkaError(error=KafkaError._ALL_BROKERS_DOWN)
assert err == KafkaError._ALL_BROKERS_DOWN

with pytest.raises(TypeError):
KafkaError(code=KafkaError._ALL_BROKERS_DOWN)


def test_kafkaError_unknown_error():
with pytest.raises(KafkaException, match="Err-12345?") as e:
raise KafkaError(12345)
Expand Down