Proper try of Cesium creation, error catching, cross browser compatibility and developer errors.

300 views
Skip to first unread message

Karol Konop

unread,
May 18, 2015, 4:55:45 AM5/18/15
to cesiu...@googlegroups.com
Hi.
I am currently working on a GIS project hat has to be cross browser, mobile, multiplatform and omnipotent.
Cesium does not work without WebGL, on some older browser and other minor exceptions, but i have to catch them. 
I decided to swich to OpenLayers when Cesium can't be an option, OL works well on pretty everything.
As for now, I have a try catch for new Cesium.Viewer, and the catch starts OpenLayers, which worked pretty great until recently, when i started getting Cesium "out of memory" error.

Cesium docs on Developer Error stands:  should never be caught; instead the calling code should strive not to generate it. 
Well how do get around to that striving ?
Is there any reliable way of checknig whether Cesium will fire up properly, or do i have to try catch every single method i am calling to be sure it won't crash out?

I'll apricieate any response, i'm kind of banging rocks together here.
Thanks in advance.
Charlie.

Kevin Ring

unread,
May 18, 2015, 7:48:08 PM5/18/15
to cesiu...@googlegroups.com
Hi,

In my Cesium-based app (it has a 2D fallback like yours, Leaflet in my case), we use this check to determine if WebGL is supported:

I haven't seen the Cesium.Viewer fail to be constructed after passing this check, although I'm sure some horribly broken WebGL implementation somewhere might fail in that way.

We also catch render loop errors and switch to 2D:

Out of memory errors can be pretty hard to recover from, though.  If Cesium is crashing due to being out of memory, you'll probably need to figure out how to reduce your memory usage, rather than attempt to catch it and recover.

Kevin

--
You received this message because you are subscribed to the Google Groups "cesium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cesium-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Karol Konop

unread,
May 20, 2015, 7:11:43 AM5/20/15
to cesiu...@googlegroups.com
Catching render loop error will be helpful here.
Thanks Kevin!


Reply all
Reply to author
Forward
0 new messages