deck.gl
deck.gl copied to clipboard
[Bug] An exception during Tile3DLayer loading doesn't trigger DeckGL `onError` callback.
Description
An exception during Tile3DLayer loading doesn't trigger DeckGL onError
callback.
<DeckGL onError=...> callback is ignored.
An error appears in the console.
Expected Behavior
It is expected for an error/exception in Deck.gl to be caught and onError
callback to be called.
Steps to Reproduce
https://codepen.io/Igor-Dykhta/pen/gOyvbYM
Environment
- Framework version: 8.9.27
Logs
The stack for the error in our app:
constructor (tileset-3d.ts:291)
_loadTileset (tile-3d-layer.ts:204)
await in _loadTileset (async)
updateState (tile-3d-layer.ts:119)
_update (layer.ts:944)
_initialize (layer.ts:886)
_initializeLayer (layer-manager.ts:339)
_updateSublayersRecursively (layer-manager.ts:303)
_updateLayers (layer-manager.ts:258)
setLayers (layer-manager.ts:206)
updateLayers2 (layer-manager.ts:218)
_onRenderFrame (deck.ts:1032)
onRender (animation-loop.js:269)
Interesting questions.
To do this, it seems to me that deck would have to wrap all calls to any external code (such as loaders.gl) in try-catch statements.
I think we may want to discuss the purpose / definition of onError()
callbacks:
- Is it mostly for reporting WebGL context failures / layer manager errors?
- Or are we intercepting all exceptions and converting them to callbacks, effectively changing the error reporting model?
I know that ScatterplotLayer
is definitely calling onError()
callback when input data is wrong.
Maybe the problem with Tile3DLayer
is that data processing is async.
All lifecycle methods are wrapped in try/catch and will fire onError if they throw synchronously. The layer manager would not know if a layer starts a floating promise, which is the case here. Tile3DLayer is responsible of catching any error here.