Skip to content
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

Closed
wants to merge 3 commits into from
Closed

Better error handling #5665

wants to merge 3 commits into from

Conversation

GmBodhi
Copy link
Contributor

@GmBodhi GmBodhi commented May 24, 2021

Please describe the changes this PR makes and why it should be merged:

I've added the property ephemeral to the CommandInteraction class.
This is useful for throwing an error while fetching an ephemeral response.

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • This PR changes the library's interface (methods or parameters added)

@xiBread
Copy link
Contributor

xiBread commented May 26, 2021

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');
Copy link
Member

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

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;
Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay

@iCrawl iCrawl requested review from vladfrangu and kyranet May 29, 2021 11:29
@kyranet
Copy link
Member

kyranet commented Jun 9, 2021

This PR has conflicting files, please rebase it on top of fixing the requested changes above?

@iCrawl
Copy link
Member

iCrawl commented Jun 23, 2021

Superseeded by #5892

@iCrawl iCrawl closed this Jun 23, 2021
@iCrawl iCrawl added this to the Version 13 milestone Jun 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants