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
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:Jump to 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...4 Replies
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
https://www.sapphirejs.dev/docs/Documentation/api-framework/#eventsUnder "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?
yes
Thank you 🙂