-
-
Notifications
You must be signed in to change notification settings - Fork 127
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
Catch out all Promises #402
Comments
isn't that bad |
U can add a debug option to allow users to enable or disable log information(s) |
I suggest that instead of just <Promise>.catch(()=>{}) There should be a logger function or some sort of error handling that would handle Promise rejections gracefully and log it out to the console, with options to enable verbose messages Something like this perhaps (just example, to get an idea about what I'm suggesting) function logger(err) {
// Do something to make error pretty for console.log
console.log(err)
}
// So when catching a Promise
<Promise>.catch(logger) |
I suggest catching all promises as u said and instead of using a logger. Just emit a error event in gwsManager with the error and the gw so there is no need to enable/disable debug option. U can just listen to that event if u want. |
I'd suggest doing either: Manager.start(...).catch(() => {}); in your code, or add a debug option to the module like tomato said, Manager.start({ ..., debug: false /* true by default */ }); which does catch the promises. |
I would favor a event one too. I mean mongoose and I think other modules do it with a event too right? |
the first one would just catch the error of the start function no? Not the ones during runtime. |
ah yeah |
Just catch out all promises in the next version please!
channel.send().catch(() => {})
members.fetch().catch(() => {});
Etc.
The text was updated successfully, but these errors were encountered: