Error handling

Hello ! Is there anything native to Sapphire that allows error handling? I want to capture all the bot's unhandled errors and to be able to act on them. Thanks!
Solution:
That error will land at chatInputRunError / contextMenuRunError / messageRunError which is the highest level catch all event for commands. NodeJS, or at least Discord bots, do not have some kind of error context that's a try/catch for everything. Errors for backend services are also different than frontend. For frontend you dont ever want to throw the user in an error state because they will see it and it disrupts their user experience, however, for backend errors they will end up in the logging at the worst and the application will remaining running...
Jump to solution
4 Replies
Favna
Favna12mo ago
listeners, various error events. The full list of events can be found at https://www.sapphirejs.dev/docs/Documentation/api-framework/#events
Sapphire Framework
@sapphire/framework | Sapphire
Namespaces
Mathias
MathiasOP12mo ago
But the errors, for example: no permission to send a message in a channel I'm a web developer and in web, I have middleware that catches everything: that means I don't need to use try / catch every time I have an error to deal with. Which can make the code unreadable
Solution
Favna
Favna12mo ago
That error will land at chatInputRunError / contextMenuRunError / messageRunError which is the highest level catch all event for commands. NodeJS, or at least Discord bots, do not have some kind of error context that's a try/catch for everything. Errors for backend services are also different than frontend. For frontend you dont ever want to throw the user in an error state because they will see it and it disrupts their user experience, however, for backend errors they will end up in the logging at the worst and the application will remaining running
Mathias
MathiasOP12mo ago
Ok thank you Favna! Well done for the work you've done on the framework, I didn't know about it, it's cool!
Want results from more Discord servers?
Add your server