UserError listener not catching all errors
I am running an imported function in my command, and calling UserError in this file and when I do, it is not caught by the listener, and my bot crashes.
Error Source: https://github.com/cosigyn/Clanware-V3/blob/master/src/mods.mjs#L229
Command: https://github.com/cosigyn/Clanware-V3/blob/master/src/commands/general/affiliate.mjs
GitHub
Clanware-V3/affiliate.mjs at master · cosigyn/Clanware-V3
Contribute to cosigyn/Clanware-V3 development by creating an account on GitHub.
GitHub
Clanware-V3/mods.mjs at master · cosigyn/Clanware-V3
Contribute to cosigyn/Clanware-V3 development by creating an account on GitHub.
1 Reply
At a glance I wouldn't be surprised if it's related to the
return new Promise
breaking the scope. It's definitely also unnecessary syntax because async functions always already return promises, you don't need to instantiate one at all. In fact, by doing so you create a promise within a promise.
Other than that, also consider all of the same the last time you had this issue. Thoroughly sanitize check all your code.
Lastly, you should read up on proper JSDoc syntax because the way you define parameters now in those doc comments is not really useful. https://dev.to/sumansarkar/how-to-use-jsdoc-annotations-with-vscode-for-intellisense-7coDEV Community
How to use JsDoc annotations with VsCode for intellisense - PART 1 ...
The Problem 🤦♂️ For many of us JavaScript devs, we love the fact that TypeScript exists....