Catch parser exception in the correct scope
This commit is contained in:
parent
692e11da37
commit
e990d04bc7
@ -27,6 +27,7 @@ carto.Renderer.prototype.render = function render(m, callback) {
|
||||
var output = [];
|
||||
|
||||
// Transform stylesheets into rulesets.
|
||||
try { // Parser may throw
|
||||
var rulesets = _(m.Stylesheet).chain()
|
||||
.map(function(s) {
|
||||
// Passing the environment from stylesheet to stylesheet,
|
||||
@ -34,15 +35,14 @@ carto.Renderer.prototype.render = function render(m, callback) {
|
||||
env = _(env).extend({filename:s.id});
|
||||
|
||||
var time = +new Date();
|
||||
// Parser may throw
|
||||
try { root = (carto.Parser(env)).parse(s.data); }
|
||||
catch (err) { callback(err, null); return; }
|
||||
root = (carto.Parser(env)).parse(s.data);
|
||||
if (env.benchmark)
|
||||
console.warn('Parsing time: ' + (new Date() - time) + 'ms');
|
||||
return root.toList(env);
|
||||
})
|
||||
.flatten()
|
||||
.value();
|
||||
} catch (err) { callback(err, null); return; }
|
||||
|
||||
// Iterate through layers and create styles custom-built
|
||||
// for each of them, and apply those styles to the layers.
|
||||
|
Loading…
Reference in New Issue
Block a user