3 ms·
As someone that grew up with exceptions, I like the idea of errors being recoverable by default. If it's not fatal, your catch block is going to swallow the exc
by ConstantineXVI 14y ago
As someone that grew up with exceptions, I like the idea of errors being recoverable by default. If it's not fatal, your catch block is going to swallow the exception anyway. And if your error is, panic().
(This could be Java experience scarring my then-young mind)
- pswenson 14y agoMost 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.