Skip to content

Instantly share code, notes, and snippets.

@miripiruni
Last active March 1, 2016 12:08
Show Gist options
  • Save miripiruni/0416aa9e400ef3091dd7 to your computer and use it in GitHub Desktop.
Save miripiruni/0416aa9e400ef3091dd7 to your computer and use it in GitHub Desktop.
Improved error msg about no block sub predicate (print out template)
var bemxjst = require('./');
// BEMHTML движок
var bemhtml = bemxjst.bemhtml;
// Компиляция шаблонов
// bemhtml.compile бросит ошибку
var templates = bemhtml.compile(function() {
// нет подпредиката для блока
elemMod('em', 'ev')
.mod('m', 'v')
.elem('e')
.match(function() { return 1; })
.tag()(function() {
return 'span';
});
});
// evalmachine.<anonymous>:795
// throw new Error('subpredicate block(\'…\') not found in template: ' +
// ^
// Error: subpredicate block('…') not found in template: mods('m', 'v').elem('e').match('…').tag(function () {
// return 'span';
// })
// at BEMHTML.groupEntities (evalmachine.<anonymous>:795:13)
// at BEMHTML.compile (evalmachine.<anonymous>:741:18)
// at evalmachine.<anonymous>:1906:5
// at Compiler.compile (/Users/miripiruni/Documents/www/bem-xjst-errors/lib/compiler.js:65:3)
// at Object.<anonymous> (/Users/miripiruni/Documents/www/bem-xjst-errors/noblock.js:6:25)
// at Module._compile (module.js:460:26)
// at Object.Module._extensions..js (module.js:478:10)
// at Module.load (module.js:355:32)
// at Function.Module._load (module.js:310:12)
// at Function.Module.runMain (module.js:501:10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment