This is sort of what HTTP codes get at though.
The server doesn't know what you want to do with a 400 but it knows that the problem is with the request for example.
The server doesn't know what you want to do with a 400 but it knows that the problem is with the request for example.
For instance, you can have a SQL error because the syntax of your SQL is wrong. If you're not doing "dynamic SQL" you know this is a programming error (it doesn't matter what input was supplied to the functions.) One common error is "attempted to insert a row with a duplicate key", frequently you want to catch that SQLException and rethrow all the rest.
The ideal SQL library for Java would expose the hierarchy implicit in SQL errors as a class hierarchy.