mapbox / carto

fast CSS-like map stylesheets
https://cartocss.readthedocs.io/
Apache License 2.0
652 stars 129 forks source link

Error handling for missing brackets in CartoCSS syntax #382

Closed knutole closed 9 years ago

knutole commented 9 years ago

Node/mapnik crashes on missing brackets in string, but it flies under the radar in carto.Renderer():

building-height: "MAX_B_H]"; // missing bracket

throws this error in node/mapnik: [Error: Failed to parse expression: "MAX_B_H]" in style 'layer' in BuildingSymbolizer of '/var/www/DATA/stylesheets/OOXYLDI.xml']

Other syntax errors are nicely caught in carto.Renderer(), perhaps useful to catch this type syntax error also.

tmcw commented 9 years ago

Expressing this as

building-height: MAX_B_H];

Will throw an error: there are carto-level expressions, essentially anything outside of "", that we parse in carto and can return errors for. Anything within quotes we pass directly to Mapnik without parsing in carto.

I'll keep open because this is a potential thing we could parse, though the user-facing fix is to use carto-level expression without quotes.

springmeyer commented 9 years ago

Not seeing any reason to keep this open. Not quoting will trigger the error. Quoting can allow values to be passed through unvalidated to Mapnik and can be useful too. Therefore I don't see value in trying to catch this error before Mapnik.