How to implement process uncaughtException on a Shopify Custom App?

tyuzu
Shopify Partner
2 0 0

I'm trying to add process "uncaughtException" and "unhandledRejection" on my Shopify App, but I'm having hardtime on it.
I tried adding it on the entry.server.jsx, shopify.server.js and on my routes but it seems not working if I purposely throw an error without catch.
Where should I possibly add this on my app? Currently my app was made using Remix template.

 

process.on('uncaughtException', (error) => {
    console.error('Uncaught Exception:', error);
    // Handle the error or perform cleanup here.
    process.exit(1);
})
.on('unhandledRejection', (reason, promise) => {
    console.error('Unhandled Promise Rejection:', reason);
    // Handle or log the rejection reason here.
});
Replies 0 (0)