I want to add error reporting to my bot and to test it I added two errors to my bot: a manually thrown one (calling
throw new Error('You've got an error!');
throw new Error('You've got an error!');
) and an E500 (in this case checking a property of a null object)
I've added the
client.on('error', (_error) => { console.log("It's a client error");});process.on('uncaughtException', (_error) => { console.log("It's an uncaught exception");});process.on('unhandledRejection', (_error) => { console.log("It's an unhandled rejection");});
client.on('error', (_error) => { console.log("It's a client error");});process.on('uncaughtException', (_error) => { console.log("It's an uncaught exception");});process.on('unhandledRejection', (_error) => { console.log("It's an unhandled rejection");});
But after triggering the "bad commands" there are no sign of these logs in console, just the errors After trying it I've added Sentry and Rollbar (not simultaneously) to the project as well but the errors doesn't appear on the dashboard Is there something in the framework what catches these errors?
Solution
define bad commands. At any rate, Sapphire has its own error handlers. Check the