3 ms·
I typically use 3 categories of exceptions when building frameworks or libraries. Two are unchecked RuntimeException extensions to indicate operating environme
by lucifer 17y ago
I typically use 3 categories of exceptions when building frameworks or libraries.
Two are unchecked RuntimeException extensions to indicate operating environment issues, and, implementation issues (aka bugs).
Finally, if the api semantics seem to indicate it, api level checked exceptions indicating misuse of the api (aka user errors). Typical example are cases where the api semantics require return values which preclude uniform application of an 'error code' as a viable means of alerting user error. I don't believe it is a good practice to throw an unchecked exception in these cases.
Both checked and unchecked exceptions have their uses.