Handle errors in ApproximateTerrainHeight.initialize #11818
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR catches errors from
ApproximateTerrainHeight.initialize
and throws them asDeveloperError
s. This is to avoid erratic behavior when the promise is rejected.When running tests locally on the webgl stub (
npm test -- --webgl-stub
), many runs would end early with an unclear error message:An error was thrown in afterAll Unhandled promise rejection: undefined thrown
Handling the error resolves the
afterAll
error in some cases.Along the way, I cleaned up some references to obsolete
.initialized
flags.Issue number and link
Possibly related to #11231.
Testing plan
Run tests locally with the webgl stub (
npm test -- --webgl-stub
). On my machine, I can consistently trigger theafterAll
error in the #d1ed5ba commit from thevoxel-pick-api
branch. The changes in this PR consistently prevent the error.Author checklist
CONTRIBUTORS.md
CHANGES.md
with a short summary of my change[ ] I have update the inline documentation, and included code examples where relevant