Error Handling

Error Handling

reciple provides a module for handling errors that causes the bot to crash. You can use this module from @reciple/modules called RecipleAnticrash.

npm i @reciple/modules

@reciple/modules is a collection of modules that are provided by reciple.

Usage

Create a new module file and export an instance of RecipleAnticrash as a default export.

import { RecipleAnticrash } from '@reciple/modules';

export default new RecipleAnticrash();

That’s basically it! This module only handles errors that are uncaught and causes the bot to crash.

This module can also be configured with options for reporting errors to a channel. The following options are available:

  • reportChannels — The channels to report errors to. It can be a channel ID or a function that returns a channel.
  • baseReportMessageOptions — The base options for the report message.
import { RecipleAnticrash } from '@reciple/modules';

export default new RecipleAnticrash({
  reportChannels: ['000000000000000000'],
    baseReportMessageOptions: {
      content: 'An error has occurred!',
  }
});