mirror of
https://github.com/sern-handler/website
synced 2026-06-07 08:22:21 +00:00
Compare commits
3 Commits
jacoobes-p
...
jacoobes-p
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3e3cc36ec8 | ||
|
|
54d269375c | ||
|
|
663410eaed |
@@ -5,12 +5,17 @@ sidebar:
|
||||
order: 9
|
||||
---
|
||||
|
||||
:::tip
|
||||
If you want sern to just capture errors with nothing other than a simple log as to the error,
|
||||
set [handleModuleErrors](/v4/api/interfaces/wrapper/#handlemoduleerrors) to handle errors that occur within modules automatically
|
||||
:::
|
||||
|
||||
Error handling is important in any application, especially one which has a long lifetime of running.
|
||||
|
||||
|
||||
## Handling errors in command and event modules
|
||||
|
||||
To capture errors, enable the 'error' event in sern's global event manager.
|
||||
To capture errors, enable the `error` event in sern's global event manager.
|
||||
|
||||
import { FileTree } from '@astrojs/starlight/components';
|
||||
|
||||
@@ -50,11 +55,7 @@ export default eventModule({
|
||||
If the error handler is not set, sern's behavior is to crash the application.
|
||||
This respects [node.js's default behavior](https://nodejs.org/api/events.html#error-events)
|
||||
|
||||
:::tip
|
||||
|
||||
enable `handleModuleErrors` to handle errors that occur within modules.
|
||||
|
||||
:::
|
||||
|
||||
:::caution
|
||||
|
||||
|
||||
@@ -118,7 +118,8 @@ export const inGuild = (guildId: string) => {
|
||||
</Steps>
|
||||
|
||||
:::note
|
||||
Calling `controller.stop()` notifies sern that this command should not be run, and command is ignored.
|
||||
Calling `controller.stop()` notifies sern that this command should not be run, and command is ignored.
|
||||
In addition, this emits a `module.activate` event on the @sern/emitter with `PayloadType.Failure`
|
||||
:::
|
||||
|
||||
:::tip
|
||||
|
||||
Reference in New Issue
Block a user