Factor out "defer" usage for better error handling
See original GitHub issueCesium uses defer
throughout the codebase as a remnant from when we were using when.js
. However, the recommended best practice is to use new Promise
constructor directly because it makes it much harder to let an exception escape. Functions passed to the construct should only reject the promise, never throw.
https://github.com/CesiumGS/cesium/pull/10149 excluded several specs in Cesium3DTilesetSpec
, GltfLoaderSpec
, TimeDynamicPointCloudSpec
, and ModelExperimentalSpec
which can be re-enabled once errors are better handled as a result of this change.
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
When defer func evaluates its parameters - Stack Overflow
Ok I just figured out. If you pass any parameters to the defer func (like the 2nd defer function above), those parameters are...
Read more >Handling Errors from Deferred Functions in Go
Being able to defer functions is a powerful feature. But with the Go error handling pattern, it can be easy to ignore errors....
Read more >Error Handling with Panic, Recovery and Defer Statement in Go
A Golang tutorial showing developers how to handle errors using panic, recovery, and defer. Learn with code examples.
Read more >More Gotchas of Defer in Go, Part II | Hacker News
Yeah, I generally feel the same way. For fairly simple use, scope is more consistent (all scopes / closures are identical), but func...
Read more >The "exceeded the max defers and failures per hour" message
# This single retry rule applies to all domains and all errors. It specifies retries every 15 minutes for 2 hours, then increasing...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok that doesn’t sound too bad. I was imagining that a larger restructuring would be needed.
We’re aiming to remove it in June. Holding off until
ModelExperimental
replaces it sounds good.@ggetz 3 areas remain:
Resource.js
and everything related to that.TaskProcessor.js
- being addressed here: https://github.com/CesiumGS/cesium/pull/10545#pullrequestreview-1037388266DeferredLoading
inKmlDataSource
- not sure if worth doing right now, that entire system could probably be reworked. I’ll open a separate issue for that too.