Re: Catching InvalidReferenceException
Daniel Dekany <[email protected]> Mon, 21 Jul 2014 20:10:34 +0200
| Newsgroups | gmane.comp.web.freemarker.devel |
|---|---|
| Message-ID | <[email protected]> |
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 <[email protected]> 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 ------------------------------------------------------------------------------ Want fast and easy access to all the code in your enterprise? Index and search up to 200,000 lines of code with a free copy of Black Duck Code Sight - the same software that powers the world's largest code search on Ohloh, the Black Duck Open Hub! Try it now. http://p.sf.net/sfu/bds