4 ms·
> For longer running processes and more complex systems, exceptions are not so great. It's almost a given that you will have a hard time tracking down all the e
by vips7L 6y ago
> For longer running processes and more complex systems, exceptions are not so great. It's almost a given that you will have a hard time tracking down all the error scenarios in your system.
I disagree. I absolutely love throwing exceptions from lower levels of my web apps and letting them bubble to be handled by exception mappers that will formulate the correct http response from them.
- ufo 6y agoI think the parent poster would classify that kind of web app under as a "short running thing". Sure, the application process might live for a long time but the requests are short-lived and independent of each other.
- TeMPOraL 6y agoEvery program is a collection of a lot of "short running things". Exceptions work well with this. There's a piece of code that calls some function and expects a result or an error; there's a piece of code much deeper in the stack that can fail. Everything in the middle doesn't care about the failure, except to make sure it doesn't get executed if the failure occurs. Without exception-like mechanism, you have to make the middle care about possible errors, just to prevent code past failure point from executing. Your calls like foo(a) get turned into if(a != error) { foo(a); }, even if it's hidden behind a nice monadic syntax.
- chubot 6y agoparent: I'm sure that can be productive for webapp code that sits between a database and the frontend.