You are right, at first: thats a quite common case, but the API throws SQLException or BadDatabaseExeption (on the open() command) only (both checked).
The specific (implementing) API throws MongoIllegalSelectWhereClauseException which extends the SQLException.
So no need for catching all the specific cases (if you did not like) just the SQLException.
I think the Java JDBC API is designed quite well.
I disagree: “data not exists” is no exception but a (more or less) usual behavior in case of database access, so return of null or an empty list will be the solution.
Here I fully agree.
Language Team, please define lots of exception-Interfaces will help when interpreting exceptions.
The extending SQLException could implement ParseCommandException, ParseValueException.
So a bad “where clause” will throw an SQLException implementing the ParseValueException that could be catched separately.
The toInt(String) function will throw the ParseValueException too.
For future languages (like Kotlin) lots of (well designed) interfaces could make code more readable and somehow more uniform between all programmers. Each interface should be as short as possible (they could be combined later).
Best example is the java interface Iterable.