Python Pulsar client appears to throw regular `Exception`s instead of `PulsarException`s
See original GitHub issueExpected behavior
The Python client should throw a subclass of Exception
, not just Exception
.
Actual behavior
An Exception is thrown. See, for example:
In [2]: p = pulsar.Client()
In [3]: c = p.get_consumer("foo")
2018-12-04 17:24:48.860 INFO ConnectionPool:63 | Created connection for pulsar://localhost:6650
2018-12-04 17:24:48.871 ERROR ClientConnection:329 | [<none> -> pulsar://localhost:6650] Failed to establish connection: Connection refused
2018-12-04 17:24:48.872 INFO ClientConnection:1237 | [<none> -> pulsar://localhost:6650] Connection closed
2018-12-04 17:24:48.872 ERROR ClientImpl:374 | Error Checking/Getting Partition Metadata while Subscribing- 5
2018-12-04 17:24:48.872 INFO ClientConnection:195 | [<none> -> pulsar://localhost:6650] Destroyed connection
< deleted internal wrapper code >
Exception: Pulsar error: ConnectError
To demonstrate it’s not a subclass:
In [8]: try:
...: c.receive(timeout_millis=500)
...: except Exception as e:
...: print(type(e))
...:
<class 'Exception'>
Steps to reproduce
Easiest way is probably supply a bogus URL to get a ConnectError
System configuration
Pulsar version: 2.2.0 for both Pulsar and the Python client
Issue Analytics
- State:
- Created 5 years ago
- Reactions:8
- Comments:9 (8 by maintainers)
Top Results From Across the Web
Python Pulsar client appears to throw regular Exceptions ...
grantwwu opened a new issue #3127: Python Pulsar client appears to throw regular Exceptions instead of Pulsar Exceptions URL: ...
Read more >Pulsar Python client
Pulsar Python client library is a wrapper over the existing C++ client library and exposes all of the same features. You can find...
Read more >API Documentation - Apache Pulsar
The Pulsar Python client library is based on the existing C++ client library. ... PartitionsRoutingMode, BatchingType # noqa: F401 from pulsar.exceptions ...
Read more >Pulsar Python client
If the format of the topic schema is incompatible with the schema definition, an exception occurs in the producer creation. Once a producer...
Read more >The Pulsar Python client
The Pulsar Python client library is a wrapper over the existing C++ client ... If there is a mismatch, the producer creation will...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I would like to work on this issue
@legendtkl ideally the exception should be wrapped in a
PulsarException
, so that application can catch a specific exception instead of a blanket catch. Also, for example when getting a timeout, one should be able to check the type of the exception