Most exceptions aren't recoverable. They are usually a result of bugs or system problems. This means 1) the bug needs to be fixed. 2) the system needs to be fixed (start up a DB service, clean disk-space, add memory, etc).
This is where java went wrong, java checked exceptions treats everything as recoverable when recovery is unlikely.
I mean, someone tries to login to a web site and the DB is down. What do you do? Or there is a bug that throws a null pointer exception. How do you recover from that?
I think the error code approach has the same effect as CheckedExceptions. People will tend to code to ignore the problems and not report them. Exceptions are great in that they bubble up to the top of the stack, so they are easy to report/alert on.
This is where java went wrong, java checked exceptions treats everything as recoverable when recovery is unlikely.
I mean, someone tries to login to a web site and the DB is down. What do you do? Or there is a bug that throws a null pointer exception. How do you recover from that?
I think the error code approach has the same effect as CheckedExceptions. People will tend to code to ignore the problems and not report them. Exceptions are great in that they bubble up to the top of the stack, so they are easy to report/alert on.