Hacker News new | ask | show | jobs
by trinix912 148 days ago
Sometimes it’s useful to handle the exception somewhere near its origin so you can close related resources, lockfiles, etc. without needing a VB6 style “On Error GoTo X” global error handler that has to account for all different contexts under which the exceptional situation might have occurred.
2 comments

Your process can crash or be killed at any moment anyway. Depending on in-band cleanup is not reliable.
Sure, but there are many cases where you don't have to halt because you can cleanup and carry on.
> a VB6 style “On Error GoTo X” global error handler that has to account for all different contexts under which the exceptional situation might have occurred

... That seems like a pretty accurate description of how exception handling mechanisms are implemented under the hood. :)