After and JAVA-720, new subclasses have been created under DriverInternalError: OverloadedException, BootstrappingException, ProtocolError, ServerError, and UnpreparedException.
While they were meant to be handled internally, they have been permeating through the driver's API:
since the query logger / latency tracker ();
and would be even more visible if they are also exposed through the enhanced RetryPolicy ().
It's also worth noting that NoHostAvailableException.getErrors() avoids exposing these exceptions by replacing them with a generic DriverException - which is clumsy.
The fact that they inherit from DriverInternalError makes one believe that they denote a bug in the driver, which is not always the case.
ServerError denotes a server-side bug and could remain under DriverInternalError
ProtocolError is generally a driver-side bug and could remain under DriverInternalError
OverloadedException is a query execution error and should be placed under QueryExecutionException
BootstrappingException is a query execution error and should be placed under QueryExecutionException
UnpreparedException is a query validation error and should be placed under QueryValidationException
It might also be a good idea to promote ConnectionException and subclasses to package com.datastax.driver.core.exceptions and make them public as well (they also appear in NoHostAvailableException as well as in the Query Logger).
And finally, the checked BusyConnectionException also appears in NoHostAvailableException.
At a quick glance, it looked to me that:
1. ServerError should go under DriverException (basically it's indicating a problem with a remote host and not within the driver)
2. OverloadedException and BootstrappingException should go under ServerError (same as above)
ServerError should go under DriverException
DriverInternalError javadocs currently say: "this should never be raised and indicates a bug (either in the driver or in Cassandra)." That's why ServerError is currently a subclass of it.
OverloadedException and BootstrappingException should go under ServerError
Semantically speaking, that's true. However the current hierarchy tends to reflect error codes, and OVERLOADED (0x1001) and IS_BOOSTRAPPING (0x1002) are both in the "Query Execution" group (codes starting with 0x1).