Bot doesn't trigger error events

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!');) 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 Events constant we export. Events.ChatInputCommandError Events.ContextMenuCommandError Events.MessageCommandError and more...
Jump to solution
4 Replies
Solution
Favna
Favna•2y ago
define bad commands. At any rate, Sapphire has its own error handlers. Check the Events constant we export. Events.ChatInputCommandError Events.ContextMenuCommandError Events.MessageCommandError and more https://www.sapphirejs.dev/docs/Documentation/api-framework/#events
Feralheart
FeralheartOP•2y ago
Under "bad commands" I mean the two commands where I made these errors purposefully I forgot about the CommandErrorEvents 😅 So if I understand correctly errors are catched in the corresponding Piece's error event, right?
Favna
Favna•2y ago
yes
Feralheart
FeralheartOP•2y ago
Thank you 🙂
Want results from more Discord servers?
Add your server