[ 
https://issues.apache.org/jira/browse/VELOCITY-654?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12654872#action_12654872
 ] 

Byron Foster commented on VELOCITY-654:
---------------------------------------

You:  "So, is there a reason you didn't log an error for all the caught 
exceptions? Would some be redundant"

To make sure we are talking about the same thing, So in patch 654_2 we have the 
following piece of code:

       try
        {
            if (!blockinput) {
                context.pushCurrentTemplateName(arg);
                ((SimpleNode) t.getData()).render( context, writer );
            }
        }
        catch(RuntimeException e)
        {
          /**
           * Log #parse errors so the user can track which file called which.
           */
          rsvc.getLog().error("Exception rendering #parse(" + arg + ") at " +
              Log.formatFileString(this));
          throw e;
        }
        finally
        {
            if (!blockinput)
                context.popCurrentTemplateName();
        }

So all caught exceptions should log an error, If I'm understanding your 
question.



> Fix correct template name reporting, enhance error logging information
> ----------------------------------------------------------------------
>
>                 Key: VELOCITY-654
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-654
>             Project: Velocity
>          Issue Type: Improvement
>          Components: Engine
>    Affects Versions: 1.6.1
>            Reporter: Byron Foster
>         Attachments: 654.patch, 654_2.patch, patch.txt
>
>
> Fix template name reporting for #include and #parse if an exception occurs.   
> Error reporting in Velocity tends to use context.getTemplateName() which is 
> intended for scoping information, and does not always provide the template 
> name containing the node or directive that generates an error.  This adds a 
> templateName field to the Directive object and assigns it on creation, if a 
> template name is available.
> Also added template and location info when logging errors thrown from #parse. 
>  This compliments the pseudo-stack trace that is already logged to error for 
> macros.  So, now a complete trace is logged to error of the macro and 
> template layers with template name and location. Yea!

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to