3 ms·
>I'd much rather my program explode immediately than risk someone letting the error passing silently because people didn't check err because like "that will nev
by xamuel 12y ago
>I'd much rather my program explode immediately than risk someone letting the error passing silently because people didn't check err because like "that will never happen".
Note that with java's checked exceptions, we get the exact opposite effect: lazy programmers catching every exception and either doing nothing at all with it or at best, printing the stacktrace and moving on. And it doesn't matter if you're not lazy yourself, the third-party code you reuse will do it.
Then there are exceptions that shouldn't even be checked, for example, you call UrlDecode and specify "UTF-8", gotta catch an exception in case "UTF-8" isn't a valid encoding name!
>try catch block being a bit cleaner
Except when you want to declare a variable and initiate it in the same line, but can't because then it would be scoped to the try block