TemplateLanguageErrorFilter for postfix errors

To suppress errors for templating languages I'm using TemplateLanguageErrorFilter. But it works for prefix errors only. 

How should I handle postfix errors like on the screenshot below?

We can see here, that JSIfStatement recovery eaten template and <. And then we've got an error. So, exactly same approach as for prefix errors won't work here, because it's depends on parser recovery process. Of course, I could fix exactly this bug, but would be nice if someone could suggest something more general.

0
6 comments
Official comment

Now I see the problem, thanks!

It seems there's no general solution yet. But we'd be happy to accept a patch/pull request.

Sorry, I don't understand what you mean by "prefix" or "postfix" errors, and why TemplateLanguageErrorFilter can't handle this.

0
Avatar
Permanently deleted user

By prefix i mean when error occurs in the beginning (just before) of the baseLanguage block. And postfix - when after it :)

Any advices how to handle this in general way?

0

What's a "base language block"? From the picture, it seems that the error occurs inside JS, and the "if statement" you have selected is also in JS. What's the problem with TemplateLanguageErrorFilter exactly?

0
Avatar
Permanently deleted user

Template files has two Psi trees - baseLanguage and dataLanguage. ErroFilter handles errors on junction of dataLanguage with baseLanguage, like var a = <error here>[% somemacro %]; 

But what to do in opposite situation, like if( [% somemacro %] <= 123) (junction of baseLanguage  with templateLanguage)

Base language block means outer element for dataLanguage.

0
Avatar
Permanently deleted user

Oh, checked Django implementatin, not handling this issue too. :(

0

Please sign in to leave a comment.