3 ms·
But you're still error handling with `.catch()`. Without that, you'd have an uncaught Promise rejection, which could take down your Node process.
by turdnagel 10y ago
But you're still error handling with `.catch()`. Without that, you'd have an uncaught Promise rejection, which could take down your Node process.
- always_good 10y agoIt's common for people to complain about something like a syntax error taking down their whole process, so that's how I read it -- that you're trying to do "too much" catching.
- Waterluvian 10y agoI'm not an expert with deploying application servers but shouldn't part of handling lifecycle include the ability for a service to crash and be respawned? Ie. Be okay if a syntax error crashes your server.
- smokeyj 10y agoYes you should be using a process manager like PM2.
- garysieling 10y agoIf you're comparing to J2EE, ASP.NET, Apache, etc, application servers tend to be big monoliths with lots of features, but Node is much lighter / more modular, so you end up setting that up yourself (that also surprised me)
- phamilton 10y agoIn a "one request per process" model, sure. But if you are handling 1000s of concurrent connections, a syntax error crashing your server means all of those connections error.
- garysieling 10y agoYeah, I'm happy to admit that I figured out how Node/Express work entirely by doing things wrong, and then fixing my mistakes :) I came to this after building C#, Scala, and Java webapps, so it surprised me that this these class of coding errors could take down a site (both screwing up the try/catch or not handling promises). There is probably some room for Node/the language/Express to make the experience better, either way it's something you'd need to know if you're new to the platform :)