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

fix(*): add missing imports for custom errors #5767

Merged
merged 2 commits into from Jun 7, 2021

Conversation

iShibi
Copy link
Contributor

@iShibi iShibi commented Jun 6, 2021

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

Since, custom errors have same names as native errors, they get left un-imported sometimes. Which results in errors that don't have any message in it. This PR fixes it by importing these errors in places where they are being used but were not imported.

Status and versioning classification:

  • I know how to update typings and have done so, or typings don't need updating

Copy link
Member

@SpaceEEC SpaceEEC left a comment

Choose a reason for hiding this comment

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

I found one more like these:

const { Error: DJSError } = require('../../errors');

and
this.debug(`Manager was destroyed. Called by:\n${new Error('MANAGER_DESTROYED').stack}`);

Considering we don't seem to be using the global Error anywhere in there, the imported class shouldn't be renamed and all occurrences of DJSError should be changed to Error.

@ckohen
Copy link
Member

ckohen commented Jun 6, 2021

I don't actually see that error key in the messages file. Given it's only used to get the stack, it doesn't strictly need to be a DJSError but I see no reason for it not to be. So just make sure to add the corresponding message

@iShibi
Copy link
Contributor Author

iShibi commented Jun 6, 2021

Done. btw I took an easy way out by just copying the same message. 😆

@vladfrangu
Copy link
Member

I don't actually see that error key in the messages file. Given it's only used to get the stack, it doesn't strictly need to be a DJSError but I see no reason for it not to be. So just make sure to add the corresponding message

Because there is no key for that error, in fact it could even be empty for all it matters :D

@iCrawl iCrawl merged commit e980948 into discordjs:master Jun 7, 2021
@iShibi iShibi deleted the fix-import-for-errors branch June 15, 2021 15:00
@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

6 participants