process.on('uncaughtException', (err) => { // handle the error safely console.error(err); });