CesiumGS / CesiumGS/cesium

Better error handling for malformed CZML

Open
#6,252 6 comments 0 reactions 0 assignees View on GitHub
category - czml type - enhancement
Dominant language
JavaScript
Stars
15.7k
Forks
3.9k
Avg merge
4d 6h
Merged PRs (30d)
34

Description

I'm just starting to generate my own CZML and I've found that the Packet parser can at times be less than helpful when you feed it bad data, as in [this simple example](https://sandcastle.cesium.com/?src=Hello%20World.html&label=Showcases&gist=13311b55ffaaff8ed890a4c203641c89).

It bombs out parsing the second of 3 entities because I fed it an enum value (`2`, number) instead of the key it was expecting (`FILL_AND_OUTLINE`, string). That's on me, of course, but it would be very nice to have *helpful* console output when this happens -- something along the lines of `invalid value "2" for property 'label.labelStyle'`. Current behavior is that it just attempts a property access on an undefined value and throws an uncaught exception. From the user perspective, it might be nice to recover from such bad values and either ignore that individual property, or at least just discard the one entity with the malformed property and attempt to continue processing all the other entities / packets in the data.

Contributor guide

Open the contributing guide

Research direction

Reproduce the malformed enum case from the linked Sandcastle example and trace the Packet parser entry point that handles the invalid label.labelStyle value. Determine whether the expected behavior is a console error, skipping the property, or discarding the entity and continuing; the issue does not choose between these options. Done should include helpful invalid-value reporting and defined recovery behavior for the remaining packets.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.