-
Notifications
You must be signed in to change notification settings - Fork 143
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
[DiscordApiError] How to handle global error(api and wss)? #1120
Comments
@aiko-chan-ai Hi, hope I can get your help 🥹🥹 |
What I normally do is throw the following code into another file and then in my index.js call it like require("./antiCrash.js")(); module.exports = () => {
process.on('unhandledRejection', (reason, p) => {
console.log(' [Anti Crash] :: Unhandled Rejeciton/Catch');
console.log(reason, p)
})
process.on('uncaughtException', (e, o) => {
console.log(' [Anti Crash] :: Uncaught Exception/Catch');
console.log(e, o)
})
process.on('uncaughtExceptionMonitor', (err, origin) => {
console.log(' [AntiCrash] :: Uncaught Exception/Catch (MONITOR)');
console.log(err, origin);
});
process.on('multipleResolves', (type, promise, reason) => {
console.log(' [AntiCrash] :: Multiple Resolves');
console.log(type, promise, reason);
});
} But when you use the throw keyword it kills the node process |
This is not a good solution, catching the corresponding error should be recommend, but we can't |
Which package has the bugs?
The core library
Issue description
Code sample
I tried to use the above code, but I still couldn't catch similar errors, including requests in wss, and still couldn't interrupt the wss connection after calling
destroy
methods.Package version
3.1.4
Node.js version
20.11.1
Operating system
MacOS
Priority this issue should have
High (immediate attention needed)
Checklist
Additional Information
No response
The text was updated successfully, but these errors were encountered: