-
Notifications
You must be signed in to change notification settings - Fork 16
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
Address graceful handling of errors in bedrock events on startup #78
Comments
It's one thing to say that top level applications should not be responsible for handling errors thrown by |
@dlongley what is the use case you have in mind for that functionality. Could we call that a future enhancement to a more expedient solution? Thinking ahead... Wouldn't it be the case that the top level app could register a |
Every framework that inverts control like that -- or doesn't follow common patterns (e.g., you call an async function and it returns a promise for you to handle) -- increases the likelihood of some kind of awkward / unexpected problem. I'd rather not deviate from common patterns unless we see no other easy way forward. When you do unusual things, expect the unexpected. If we do not deviate from common practice, then we don't have to worry about people coming up with applications that would work with the common composition model but no longer do with bedrock. This is the sort of thing that created many headaches for us with other frameworks like mocha/protractor/etc -- when we wanted to combine them with another framework of our own (bedrock, for example). I don't want to create similar problems for people (including us) who want to combine bedrock with frameworks X, Y, and Z. |
Reminder that this issue is unresolved. https://gist.github.com/mattcollier/f9ebbdc91f89a9227ff67c7b7ac0272f |
I think this is resolved now. If a promise is rejected that is not handled, bedrock captures it and exits. The app creator also has the option to capture that error via |
There are multiple open issues that are directly or indirectly related to this topic. Here's some code that demonstrates the problem so we can talk about what we would like to happen in these cases and where the error handling should occur.
The issue of the day for me is that we build MongoDB indexes inside of Bedrock event handlers. If an error occurs during indexing, the error is not properly surfaced and the server continues to operate when it should have failed to start IMO.
Here are my thoughts on what the solution looks like:
bedrock.start
. We should continue to be able to simply dobedrock.start();
in top level applications as we are already doing now.process.exit(1);
would be fine for an immediate solution. In the fullness of time, Initiate whateverbedrock.exit
process may be created.Related issues:
#69
#60
#56
#44
The text was updated successfully, but these errors were encountered: