tangrams / tangram

WebGL map rendering engine for creative cartography
https://tangram.city
MIT License
2.22k stars 290 forks source link

unhandled invalid font color error prevents drawing #627

Open meetar opened 6 years ago

meetar commented 6 years ago

in v0.14.2, if a font: fill or a stroke: color is a function which returns an invalid color value, drawing is prevented for the related tile, and the console returns:

Tangram v0.14.2 [error]: Error building tile mapzen/9/82/198/9: TypeError: Cannot read property '3' of undefined

Example scene file:

sources:
    mapzen:
        type: TopoJSON
        url: https://tile.mapzen.com/mapzen/vector/v1/all/{z}/{x}/{y}.topojson

layers:
    places:
        data: { source: mapzen }
        draw:
            text:
                font:
                    fill: function() { return feature.nonexistant_color_property }

EXPECTED RESULT:

If a polygon style has a similar color setting it simply doesn't draw – In both cases a more descriptive error message could mention an invalid color as a clue about what was wrong.