3 ms·
Checked exceptions sound good on paper. In practice I think I re-threw every checked exception as unchecked. In retrospect I feel like 'handling' exceptions i
by mrkeen 7y ago
Checked exceptions sound good on paper. In practice I think I re-threw every checked exception as unchecked.
In retrospect I feel like 'handling' exceptions is a myth. If you knew how to handle them, they wouldn't be exceptional.
- tsimionescu 7y agoChecked exception interact poorly with higher-order functions, but are otherwise pretty nice in my experience. If Java had a more powerful type system to allow it to abstract over exception type, it may have been a much more liked feature. Regarding handling, in my experience the vast majority of code has no way of handling an error (whether we're talking about exceptions or error-codes or Result<T, E>) except for logging and returning it up the call stack, or immediately aborting soemtimes. But there are places in the program where there rely is enough information to handle an error from a whole sub-module, usually by retyping with other params, by asking the user for advice, or by simply telling the user that something they did was wrong. Getting the right amount of error information to this place is the problem that exceptions solve the best in my opinion.