Catch parser exceptions (it does throw!)
This commit is contained in:
parent
a04ad1c388
commit
07ca2dad27
@ -33,9 +33,10 @@ carto.Renderer.prototype.render = function render(m, callback) {
|
|||||||
// allows frames and effects to be maintained.
|
// allows frames and effects to be maintained.
|
||||||
env = _(env).extend({filename:s.id});
|
env = _(env).extend({filename:s.id});
|
||||||
|
|
||||||
// @TODO try/catch?
|
var time = +new Date();
|
||||||
var time = +new Date(),
|
// Parser may throw
|
||||||
root = (carto.Parser(env)).parse(s.data);
|
try { root = (carto.Parser(env)).parse(s.data); }
|
||||||
|
catch (err) { callback(err, null); return; }
|
||||||
if (env.benchmark)
|
if (env.benchmark)
|
||||||
console.warn('Parsing time: ' + (new Date() - time) + 'ms');
|
console.warn('Parsing time: ' + (new Date() - time) + 'ms');
|
||||||
return root.toList(env);
|
return root.toList(env);
|
||||||
|
Loading…
Reference in New Issue
Block a user