wuchenxi123 commented on pull request #11112: URL: https://github.com/apache/pulsar/pull/11112#issuecomment-869770568
> 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. I have modified it, please check -- 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: commits-unsubscr...@pulsar.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org