catch fatal parsing errors

This commit is contained in:
tophf 2018-01-30 18:52:38 +03:00
parent 02989edb05
commit 95a24cd29b

View File

@ -80,9 +80,13 @@ function parseMozFormat({code, styleId}) {
errors.push(`${e.line}:${e.col} ${e.message.replace(/ at line \d.+$/, '')}`); errors.push(`${e.line}:${e.col} ${e.message.replace(/ at line \d.+$/, '')}`);
}); });
parser.parse(mozStyle, { try {
reuseCache: !parseMozFormat.styleId || styleId === parseMozFormat.styleId, parser.parse(mozStyle, {
}); reuseCache: !parseMozFormat.styleId || styleId === parseMozFormat.styleId,
});
} catch (e) {
errors.push(e.message);
}
parseMozFormat.styleId = styleId; parseMozFormat.styleId = styleId;
return {sections, errors}; return {sections, errors};