New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better error handling #5665
Better error handling #5665
Conversation
The typings need to be updated as well. |
@@ -139,6 +146,7 @@ class CommandInteraction extends Interaction { | |||
* .catch(console.error); | |||
*/ | |||
async fetchReply() { | |||
if (this.ephemeral) throw new Error('Unable to fetch ephemeral response'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current error surely does not look right 😄
Error: An invalid error message key was used: Unable to fetch ephemeral response.
You need to register your error in this object here
discord.js/src/errors/Messages.js
Line 115 in 3a8ba57
INTERACTION_ALREADY_REPLIED: 'This interaction has already been deferred or replied to.', |
Maybe
INTERACTION_EHPEMERAL_REPLIED
?
* Whether the reply to this interaction is ephemeral | ||
* @type {boolean} | ||
*/ | ||
this.ephemeral = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe initialize it with null
since the interaction wasn't replied to yet?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay
This PR has conflicting files, please rebase it on top of fixing the requested changes above? |
Superseeded by #5892 |
Please describe the changes this PR makes and why it should be merged:
I've added the property
ephemeral
to theCommandInteraction
class.This is useful for throwing an error while fetching an ephemeral response.
Status and versioning classification: