Skip to content

[6.x] [ftr/asyncInstance] fix error thrown for undefined provider instances (#22689)#22698

Merged
spalger merged 1 commit intoelastic:6.xfrom
spalger:backport/6.x/pr-22689
Sep 5, 2018
Merged

[6.x] [ftr/asyncInstance] fix error thrown for undefined provider instances (#22689)#22698
spalger merged 1 commit intoelastic:6.xfrom
spalger:backport/6.x/pr-22689

Conversation

@spalger
Copy link
Copy Markdown
Contributor

@spalger spalger commented Sep 4, 2018

Backports the following commits to 6.x:

…elastic#22689)

When a FTR service is created async the promise created by its provider is wrapped in a [`Proxy`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Proxy) that checks before each property access if the instance has finished initializing. This breaks if the service provider returns undefined, which is the case for the `failureDebugging` service, because our truthy check will fail and we throw the error claiming the service is uninitialized, which is probably incorrect.

This PR updates the proxy to use a `Symbol` to indicate when a service instance is not available yet and throws a different error when the proxy receives any request (get, set, etc.) and the service instance is not an object, as required by the Reflect APIs.
@spalger spalger added the backport This PR is a backport of another PR label Sep 4, 2018
@spalger spalger merged commit e6d036e into elastic:6.x Sep 5, 2018
@spalger spalger deleted the backport/6.x/pr-22689 branch September 5, 2018 00:01
@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants