BewareMyPower commented on pull request #11112:
URL: https://github.com/apache/pulsar/pull/11112#issuecomment-869261030


   You may misunderstand my comment.
   
   > IMO it's not a good practice to just use Exception as the checked 
exception but not the subclass of Exception.
   
   I mean use a derived class of `Exception` as the checked exception. You 
replaced `Exception` with `RuntimeException`, which is worse because 
`RuntimeException` is an unchecked exception. Take 
`org.apache.pulsar.metadata.api.MetadataSerde` as an example:
   
   ```java
   public interface MetadataSerde<T> {
   
       byte[] serialize(T value) throws IOException;
   
       T deserialize(byte[] content) throws IOException;
   }
   ```
   
   It checks `IOException` that derives from `Exception`. You can also some 
many other interfaces in Pulsar that checks `PulsarAdminException` or 
`PulsarClientException`, not `Exception` directly.
   
   Though IMO it's a better practice, using `Exception` directly is also okay 
but don't use `RuntimeException` as the checked exception.


-- 
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.

To unsubscribe, e-mail: [email protected]

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


Reply via email to