Improve KML network error handling
- Dominant language
- JavaScript
- Stars
- 15.7k
- Forks
- 3.9k
- Avg merge
- 4d 6h
- Merged PRs (30d)
- 34
Description
Sandcastle example: [here](https://sandcastle.cesium.com/#c=dVTvb9MwEP1XrHxJqhV7nYSEhpshNoaAsX0I8GVBm5tcV6uOXdlOsjLtf+fs/qQb/dL47r27e+eXdMKSTkIPloyJhp6cg5NtQ3/FWJZW8XhutBdSg00H70vdIccsvDTaIemp1AR/lWjACnK6rkZdBRroKjrcQJDqXkJCtNTPWLnUFRb1ZN6owlupH7D+PT97bBTpwDrsOE5H9DglgMAa8+P054/LN+/Ss7zUHFkEodqN05n3i1PG+r6nZgH6QTqqwTNEsBN6kuargfiFqdoGtF+fY0zjyLmSes5ZfNxLXYPvjZ1fYXIvHFOddHIilfTLfMTZ3ukAF0t+VmYiFCkqiTqAXIoqYCW4Fy0j55V+MT6zMM2DUodSndB1JZxXuNHVFVamYYVoFgouhBdR+3Tbae+RYoazWOyVJhi24GbfTQ250V+0B9sJxO/H/0/b4PO3W8Y2dKCSHcjk7OW6Odu7MR4k4f99NM7at98aFdQWprUVUGVEna2owdsfce/Z7dZcv4fkyS8XcErKxMOjZ2ieMnkeDDfuLvWA+hnozNmKjPON1fFEwVpjP3U4CRV1HR+upPNoaJtlDtR0SBAyQNZOUfC2UWGqh6xM8rxMyBH5WtxcUxfnkdNlFklHOBDnZTIYRGmBu35l6q02F/qGwXYYxkghm1YJDyg37o5MhVSthd3gd3q3VUfvhLVieXv8m4b7p61V+MaVycZUgk1EzcLLUCbbNr3Utelp3EkoiYnn1RDJMOHOL9XGER9kszDWEyybUco8oBlxOMcmbTUHTyvnApGzDYnXsiOyHpfJwXcHV1Up4Rxmpq1ShfwDuEHOEP8PLVw4bvIGvxZKLANkNsqvVkFKKdp89ArLG6Mmwu5VLPVf)
Browser: any
Operating System: any
The Sandcastle example makes a simple NetworkLink-based KML data source then "breaks" the network resource to simulate a real error. There are a couple of issues with how this plays out:
* The error event fires once with a `RequestErrorEvent` structure but it's empty.
* Nothing passed to the event callback tells us which URL failed to load.
* The error event fires a second time with a user-facing string, but we have no easy way to tell the difference.
* The generated string includes "[object Object]" because it was computed using string concatenation against a `Resource`, which does not (but probably should?) have a `toString` method.
Ideally, any failed network calls performed by the KmlDataSource should fire an error event that tells us what failed to load and (if known) why. Each event type should pass one type of argument to the callback, not a mix of structures (RequestErrorEvent) and strings.
Note that my example doesn't simulate e.g. loading a billboard image from a bad URL, but that would be a good further test case to ensure consistency.
Also, note that if the network link fails to load once, the only way to "get back on track" is to call `load()` again. Failure to set up the NetworkLink means that this element is ignored. It would be nice to have a method we could call that would retry failed links without a full reload.
Contributor guide
Research direction
Start with KmlDataSource's NetworkLink handling and the error event path exercised by the linked Sandcastle example. Trace load() and failed resource callbacks, then inspect how RequestErrorEvent, strings, and Resource are passed. Done means consistent error arguments that identify the failed URL and cause, corrected message formatting, and a considered way to retry failed links.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100