People want error handling to vanish so that they can follow the "normal" flow, but in fact error handling is one of the critical things code does.
People want error handling to vanish so that they can follow the "normal" flow, but in fact error handling is one of the critical things code does.
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.