You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Collin Peters <cp...@intouchfollowup.com> on 2012/10/03 21:27:31 UTC

Is it possible to continue processing instead of throwing a ParseErrorException?

Just wondering if it is possible to skip bad merge fields and just have it
try to continue?  The use case is that we want to present the processed
text, even if it has errors, to the end user so that the error can be
visually seen

e.g
Dear $!{user.firstName}, welcome to $!{club.n<span
style="font-size:12">ame}</span>

Would show up as
Dear Johnny, welcome to $!{club.n<span style="font-size:12">ame}</span>

--
Collin Peters
cpeters@intouchfollowup.com
(206) 855-6656 (Direct Line)

Re: Is it possible to continue processing instead of throwing a ParseErrorException?

Posted by Christopher Schultz <ch...@christopherschultz.net>.
Nathan,

On 10/3/12 3:38 PM, Nathan Bubna wrote:
> Velocity uses a JavaCC generated parser.  So far as i know, JavaCC
> doesn't support this kind of soft-fail parsing.

On the other hand, Velocity could fail completely and show the original
template source. That's not a great solution IMO, though because it
could expose all kinds of things to a remote user.

-chris


Re: Is it possible to continue processing instead of throwing a ParseErrorException?

Posted by Nathan Bubna <nb...@gmail.com>.
Velocity uses a JavaCC generated parser.  So far as i know, JavaCC
doesn't support this kind of soft-fail parsing.

On Wed, Oct 3, 2012 at 12:27 PM, Collin Peters
<cp...@intouchfollowup.com> wrote:
> Just wondering if it is possible to skip bad merge fields and just have it
> try to continue?  The use case is that we want to present the processed
> text, even if it has errors, to the end user so that the error can be
> visually seen
>
> e.g
> Dear $!{user.firstName}, welcome to $!{club.n<span
> style="font-size:12">ame}</span>
>
> Would show up as
> Dear Johnny, welcome to $!{club.n<span style="font-size:12">ame}</span>
>
> --
> Collin Peters
> cpeters@intouchfollowup.com
> (206) 855-6656 (Direct Line)

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org