NealSun96 opened a new issue #832: Improve MetadataStoreDirectoryAccessor endpoint status codes URL: https://github.com/apache/helix/issues/832 Currently, the endpoints in `MetadataStoreDirectoryAccessor` are missing proper status codes for some cases: for example for `IllegalArgumentException`, it's most fitting to return 400 Bad Request to users, but currently the exception will not be handled and cause a 500 to be returned. A change that can fix this issue while improving the status code behavior is to bind exception types with status codes. `NoSuchElementException` should be paired with 404, `IllegalArgumentException` should be paired with 400, while `IllegalStateException` (currently used when underlying ZkClients are closed) should be paired with 500. This has two major benefits: 1. Code maintenance is made easier. The exception types clearly and meaningfully translate to status codes. Developers no longer need to traverse layer by layer to figure out what happened to each exception; all of them are handled at the accessor layer. 2. The status codes are verbose and helpful, because they now contain the underlying exception messages that explain the exact reason behind the exceptions. To enable this, the setter methods in `ZkMetadataStoreDirectory` needs to throw `NoSuchElementException` for missing namespaces like the getter methods.
---------------------------------------------------------------- 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] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
