CRBT-Team / Purplet

A framework for quickly building Discord bots + more packages relating to the Discord API, with a primary goal on a rich developer experience.
https://purplet.js.org
Apache License 2.0
64 stars 1 forks source link

Interaction error responses #29

Open paperdave opened 2 years ago

paperdave commented 2 years ago

If an interaction handler throws and the interaction wasn't responded to, we could consider calling .showMessage with a formatted error.

Two forms of errors should be accepted, one being a custom error class like InteractionError, which contains CreateMessageData and can be passed directly as the response, with normal errors having a preset formatter.

This behavior should be configurable within the config, so we might be depending on #9. Config should follow this schema:

paperdave commented 2 years ago

when InteractionError is written, the default formatter should be a static method on it, meaning the default config entry is just formatter: InteractionError.defaultFormatter