-
Notifications
You must be signed in to change notification settings - Fork 66
waitUntilReady never throws an error #96
Comments
This is a reasonable request - we are just trying to decide on the best way to implement it that will preserve backward compatibility. The issue is this: an unhandled promise rejection is a serious problem that can crash the application. And in the past, users of the SDK have not been required to attach an error handler to this promise, because we never rejected it. So if we start triggering rejections, that is potentially a breaking change. I know that in your case, you want to kill the app anyway if there is a startup error from LD, but that is not necessarily true of everyone - some people may want the app to run with limited functionality, using the default values that the client returns when it's in this state. Another option would be that we fire the ready event / resolve the promise, just like we would if the client successfully started up, but provide the error as an optional parameter. I know it is a bit odd to receive an error in your |
To avoid breaking existing applications, we're going to implement this by providing a new method, |
That works great too. But, why not just a major version bump if it's a breaking change? |
@scottcorgan, even in a major version release, we would rather not introduce breaking changes that are as subtle as this one would be. That is, since the success case would still work as before, a developer who didn't read every word of the changelog could easily conclude that the application was still working fine so no code changes were needed - until the first time there was an outage at startup time, which would crash the application. So we feel it is more developer-friendly to add a new method, and deprecate the old one until the next major version release. |
That's fair. A new method is an elegant solution. |
This is now implemented in version 5.1.0: the new method |
implement evaluation with explanation
Simple use case:
When the client gets 401 error it stops trying to connect, which effectively means that initialisation failed, so I expect waitUntilReady to fail so I can fail to start my server and kill the app, but that never happens (although it logs the error).
The text was updated successfully, but these errors were encountered: