#Add node process unhandledRejection handler.

3 messages · Page 1 of 1 (latest)

stoic quartz
#

Hi, I am using astro with node ssr. I want to customize node behavior to not exit node in case of ERR_UNHANDLED_REJECTION .
I can do this by adding handler

process.on('unhandledRejection', (reason, promise) => {
    console.error('Unhandled Promise Rejection:', reason);
    // Handle the rejection, or at least log it for later debugging
    // You might also consider reporting it to an error tracking service
});

However, it is not clear to me where exactly should I put this logic ?

brittle riverBOT
#
Still waiting for an answer?

It looks like no-one has responded to your question yet. People might not be available right now or don’t know how to answer your question. Want an answer while you wait? Try asking our experimental bot in #1095492539085230272.

torn belfry
#

In standalone mode, since astro outputs dist/server/entry.mjs, you can create another node script and import/wrap this script how you want I think