error management, an exception is thrown when there is a parse error
This commit is contained in:
parent
bc9d67b328
commit
4f963b8bb3
@ -131,7 +131,8 @@ CartoCSS.renderers['canvas-2d'] = {
|
||||
'line-opacity': 'globalAlpha',
|
||||
// polygon
|
||||
'polygon-fill': 'fillStyle',
|
||||
'polygon-opacity': 'globalAlpha'
|
||||
'polygon-opacity': 'globalAlpha',
|
||||
'comp-op': 'comp-op'
|
||||
},
|
||||
|
||||
transform: function(src) {
|
||||
@ -218,6 +219,9 @@ CartoCSS.prototype = {
|
||||
|
||||
setStyle: function(style) {
|
||||
var layers = this.parse(style);
|
||||
if(!layers) {
|
||||
throw new Error(this.parse_env.errors);
|
||||
}
|
||||
this.layers = layers.map(function(shader) {
|
||||
return new CartoCSS.Layer(shader);
|
||||
});
|
||||
@ -229,6 +233,7 @@ CartoCSS.prototype = {
|
||||
|
||||
_createFn: function(ops) {
|
||||
var body = ops.join('\n');
|
||||
console.log(body);
|
||||
return Function("data","ctx", "var _value = null; " + body + "; return _value; ");
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user