apache / pulsar-client-python

Apache Pulsar Python client library
https://pulsar.apache.org/
Apache License 2.0
49 stars 38 forks source link

Document for the pulsar.Result enum #185

Open BewareMyPower opened 6 months ago

BewareMyPower commented 6 months ago

The pulsar.Result enum is just imported from the C extension. See https://github.com/apache/pulsar-client-python/blob/daabc677e06e867f84beaeb3912d1d450cddf54d/pulsar/__init__.py#L50

Running help(pulsar.Result) could only show the underlying C error codes like

 |
 |  AlreadyClosed = <Result.AlreadyClosed: 15>
 |
 |  AuthenticationError = <Result.AuthenticationError: 7>
 |
 |  AuthorizationError = <Result.AuthorizationError: 8>
 |
 |  BrokerMetadataError = <Result.BrokerMetadataError: 10>
 |
 |  BrokerPersistenceError = <Result.BrokerPersistenceError: 11>

The error code should be well documented. Otherwise users might not know how to handle these error codes.

For now, users can refer https://github.com/apache/pulsar-client-cpp/blob/main/include/pulsar/Result.h for the meaning of error codes.