bem/bem-xjst

Check for existence of base templates does not work for development mode

Closed this issue · 2 comments

Hello.

Now I'm working on task enb/enb-bemxjst#60.
I have used this way for check the existence of base templates.

oninit(function(exports, context) {
  if(!context.BEMContext) throw Error('Seems like you have no base templates from i-bem.bemhtml');
})

But it seems that this works only for production mode.
I need to have this validation for development mode too.

Please help for resolve this issue.

@blond @tadatuta @veged

veged commented

there is a error catching for everything — https://github.com/veged/xjst/blob/3a2fe343c9856fe4a163bd3d07b194350c41211b/lib/xjst/compiler/base.js#L109

we need to add some filter so our particular errors can be thrown up — since it was introduce for proper work of match(this.my.custom.match) we can add some check like e instanceof TypeError

i.e.

           '} catch (e) {\n' +
           '  // Ignore only TypeError errors\n' +
           '  if(!(e instanceof TypeError)) throw e;' 
           '}\n' +

@tormozz48 do you wanna make PR? ;-)

I have tested enb-bemxjst package with forked bem-xjst and xjst dependencies which contains fix from above. It seems that all is OK.

@blond @tadatuta @veged

We need to:

  • merge veged/xjst#48
  • publish new version of xjst package
  • publish new version of bem-xjst package (v1.0.4 maybe)