kosmtik / kosmtik

Make maps with OpenStreetMap and Mapnik
Other
724 stars 84 forks source link

Kosmtik crash when error is found in style.mss #19

Closed denics closed 9 years ago

denics commented 9 years ago

Hi all,

this morning I added few (wrong) lines to style.mss to display a border as dotted:

#boundary[name='Italy'] {
    line-dasharray: [1, 1];    
}

and I got this error:

node index.js serve  --host 0.0.0.0 --proxy="http://www.proxy.org:8080" --mapnik-version=2.2.0 /project.mml
[Core] Loading config from /Users/denix/.config/kosmtik.yml
[Core] Loading plugin from ../plugins/base-exporters/index.js
[Core] Loading plugin from ../plugins/hash/index.js
[Core] Loading plugin from ../plugins/local-config/index.js
[Core] Loading plugin from ../plugins/datasource-loader/index.js
[Core] Loading plugin from kosmtik-fetch-remote
[Core] Loading plugin from kosmtik-overpass-layer
[Core] Loading plugin from kosmtik-place-search
[Core] Loading plugin from kosmtik-overlay
[Core] Loading plugin from kosmtik-osm-data-overlay
[Core] Loading plugin from kosmtik-open-in-josm
[Core] Loading plugin from kosmtik-map-compare
[Core] Loading plugin from kosmtik-deploy
[Core] Loading plugin from kosmtik-tiles-export
[Core] Loading project from /project.mml
[Core] PreviewServer started, you can browse http://0.0.0.0:6789
[Fetch Remote] Done.
[Overpass Layer] File already exists and not force mode /data/countries.geojson Skipping
[Overpass Layer] File already exists and not force mode /data/cities.geojson Skipping
[Core] Generating Mapnik XML…
[Core] Using mapnik version 2.2.0

/Volumes/external/git/kosmtik/node_modules/carto/lib/carto/renderer.js:152
    if (env.errors) throw env.errors;
                             ^
Error: style.mss:27:4 Invalid value for line-dasharray, the type numbers is expected. [1,1] (of type field)  was given.
    at Object.env.error (/Volumes/external/git/kosmtik/node_modules/carto/lib/carto/parser.js:235:55)
    at Rule.tree.Rule.toXML (/Volumes/external/git/kosmtik/node_modules/carto/lib/carto/tree/rule.js:83:24)
    at Definition.tree.Definition.symbolizersToXML (/Volumes/external/git/kosmtik/node_modules/carto/lib/carto/tree/definition.js:139:46)
    at Definition.tree.Definition.toXML (/Volumes/external/git/kosmtik/node_modules/carto/lib/carto/tree/definition.js:200:29)
    at /Volumes/external/git/kosmtik/node_modules/carto/lib/carto/tree/style.js:31:27
    at Array.map (native)
    at Object.tree.StyleXML (/Volumes/external/git/kosmtik/node_modules/carto/lib/carto/tree/style.js:30:29)
    at Renderer.render (/Volumes/external/git/kosmtik/node_modules/carto/lib/carto/renderer.js:134:39)
    at Carto.render (/Volumes/external/git/kosmtik/src/back/renderer/Carto.js:20:45)
    at Project.render (/Volumes/external/git/kosmtik/src/back/Project.js:57:25)

that make Kosmtik to crash. The right behavior should be to display the error and continue (I think).

Best.

yohanboniface commented 9 years ago

Thanks for the report! Should be fixed with https://github.com/kosmtik/kosmtik/commit/efa0f704ca7d87108f1b5a6370d87088bbb84d5f