-
Notifications
You must be signed in to change notification settings - Fork 49
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
(examples) Do not throw in async flows #7
Comments
Throw in that callback will crash your process :) |
I know, I was just thinking that's is wrong to put it there; a good |
It definitely depends on your code, for example, you have a web service that needs mongodb, without it cannot work. Don't forget that the callback is executed at bootstrap time, so if it have to crash, it will do it when you open up the server, not at "runtime" :) |
I disagree but ok, I got your point. |
The correct approach is not to place any callback there. The default behavior in case of error is well defined (it will emit an Placing |
Hey,
I was just having a look to this plugin and, reading the example, I noticed this:
Throwing in in async flow is an antipattern, it will probably crash your entire process as nobody can catch that exception. While it's just an example, you might want to write a different code to handle the error.
P.S: The same goes in the
listen
function below.The text was updated successfully, but these errors were encountered: