Re: [Freemarker-devel] Catching InvalidReferenceException
Generates text that depends on changing data (like dynamic HTML).
Brought to you by:
revusky
From: Daniel D. <dd...@fr...> - 2014-07-21 18:10:46
|
Monday, July 21, 2014, 6:01:02 PM, David Haraburda wrote: > Thanks Daniel. > > I don't see a 2.3.21 branch on github It's the 2.3 and 2.3-gae branches. Tagging with version number happens after release. > but we would probably wait for an official release anyway. It meant to be released in August... the end of it, I guess. But the more people tests it, the better. > What you describe sounds like it will work perfect for our use case. > > Thanks again, > David > > > On Sun, Jul 20, 2014 at 11:54 AM, Daniel Dekany <dd...@fr...> wrote: > Wednesday, July 16, 2014, 9:56:04 PM, David Haraburda wrote: > >> I noticed that when InvalidReferenceException is thrown, it would >> potentially be useful if the exception exposed the string of the >> invalid expression directly as an attribute. That way code that >> catches the exception can say ex.getExpression() and use this to >> generate it's own error message (i.e. internationalized) or do further processing. >> >> Would a simple patch that allows this be accepted if I submitted >> one to the project? Or is there a better way to directly get at the offending expression? > > In 2.3.21, if you check that out from GitHub (it's not yet released), > InvalidReferenceException inherits such facility from > TemplateException: getBlamedExpressionString(). (As the > freemarker.core.Expression API is not published, you can't get the > Expression yet, but maybe it helps that said method returns the > canonical form so you don't have to do tricky normalizations to > extract some info.) You can also get the location of the offending > expression. > >> Thanks, >> >> David > > -- > Thanks, > Daniel Dekany -- Thanks, Daniel Dekany |