Open cguldner opened 7 years ago
The issue is that Cesium uses a heuristic to determine how to parse the styleurl and it's failing with the leading/trailing space, as you identified. The immediate fix is probably to trim()
the URL before picking it apart, but the larger issue is that there are a lot of network calls for different reasons and the errors usually bubble up several levels before being handled, so you don't have the context for which call failed (or why it was made) by the time it shows up in the console.
It would be helpful if some debugging messages were inserted in the middle of that exception chain, along the lines of
.otherwise(function(error){
console.log("Failed to load external style '" + uri + "'", error);
return when.reject(error);
}
Likewise, various loading / parsing failures just log the XHR error or XML parser output directly without including a description of what was being done when the failure occurred. It's much more useful to say console.log("Failed to load document from NetworkLink", error);
than just console.log(error);
.
I think there needs to be more helpful errors when a KML file fails to load. For example, I spent a long time trying to debug this error when adding a KML file to Cesium
I tried with the unminified Cesium.js file, and it just pointed me to the place where the error was raised, not giving me any insight into what was wrong. I figured it was a problem with a link somewhere, since it was making an HTML request. Only after looking at it for a couple hours did I finally figure out the issue. I had my
styleUrl
s with spaces around it in myPlacemark
sI feel like the Cesium file easily could have given me a much more descriptive error. Maybe not specifically where the error was happening, but at least there was an undefined style referenced