question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Better error handling for malformed CZML

See original GitHub issue

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.

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.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
shuntercommented, Feb 22, 2018

There is a JSON Schema for CZML which does catch this error (after fixing the other JSON violations from the snippet (missing quotes, extra commas))

Invalid: data.label.style.labelStyle should be equal to one of the allowed values, data.label.style.labelStyle should be equal to one of the allowed values, data.label.style.labelStyle should be equal to one of the allowed values, data.label.style.labelStyle should match exactly one schema in oneOf, data.label.style.labelStyle should be string

https://github.com/AnalyticalGraphicsInc/czml-writer/tree/master/Schema

This could be the foundation of a validation tool. validate.js in the above directory uses Ajv to validate the example snippets which appear in the CZML spec. However, the script is pretty basic and expects each file to contain exactly one packet, so I had to manually split up the document to get it to report the above error.

0reactions
OmarShehatacommented, Aug 6, 2020

Just ran into this today: https://community.cesium.com/t/strange-error-when-loading-my-czml-file/10467. Here the issue was a missing “epoch”, and the error message tells you there’s a missing JulianDate but it’s hard to trace exactly what is missing.

CesiumJS already has a mechanism for catching errors without slowing down the runtime. Is there any reason not to add checks like this throughout CZMLDataSource that would be stripped out in the release version?

  //>>includeStart('debug', pragmas.debug);
  Check.defined("packet.epoch", packet.epoch);
  //>>includeEnd('debug');
Read more comments on GitHub >

github_iconTop Results From Across the Web

Better error handling for malformed CZML · Issue #6252 - GitHub
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...
Read more >
Error handling and messages for Community Connectors
Best practices for handling connector errors. Handle recoverable errors ... API request that can be malformed. getDataFromAPI(); } catch (e) ...
Read more >
“CZML” extrude animation error - cesium - GIS Stack Exchange
the corresponding time and polygon are recognized, but the height is not recognized. how can i solve it? let czml = ""; setInterval(function...
Read more >
19. Beyond Exception Handling: Conditions and Restarts
The condition system is more flexible than exception systems because instead ... For instance, one way to handle the malformed-log-entry-error signaled by ...
Read more >
"Invalid array length" error when streaming CZML
Is there anything I'm missing here? I couldn't find a good example of streaming CZML, so I'm sure I've done something dumb and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found