fhussonnois opened a new issue #8277:
URL: https://github.com/apache/pulsar/issues/8277


   **Is your enhancement request related to a problem? Please describe.**
   Currenlty the `PulsarClientException` extends the `IOException` class which 
is a checked-exception. Of-course checked vs unchecked exception has been a 
long debate in the Java community but I see two main issues with this is Pulsar 
: 
   
   **1. Bad Developer Experience**
   
   As most of the methods provided by the client/producer/consumer/reader APIs 
can throw a `PulsarClientException`, this forces developers to eventually wrap 
the code with a try-catch block or simply rethrow the exception, which can make 
future refactoring painful.
   
   Furthermore, in many cases we just don't have the choice to reject the 
exception again because we can't do anything else but stop ourapplication, eg: 
we failed to initialise the `PulsarClient`.
   
   Finally, it also limits the use of Java lambda expressions or portability to 
other JVM languages such as Kotlin.
   
   **2. Inconsistency**
   
   For example, the `InvalidConfigurationException` extends the 
`PulsarClientException` and hence the `IOException` but is not related to any 
interrupted I/O operations.
   
   **Describe the solution you'd like**
   Create a top-level exception class `PulsarException` that extends the 
`RuntimeException` class. Both `PulsarClientException` and 
`PulsarAdminException` should then extend the `PulsarException` class.
   
   **Describe alternatives you've considered**
   
   
   **Additional context**
   This is a breaking-change.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to