Uploaded image for project: 'Velocity'
  1. Velocity
  2. VELOCITY-626

Log to error macro exceptions

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.6
    • 1.6
    • Engine
    • None

    Description

      This patch logs to error the exceptions that occur within a macro. This essentially creates a stack trace in the error log of the macro stack levels that contain the exception. For example: (This is with strict reference settings, but the same would be true without strict referencing and an exception was thrown from within the reference call)

      #macro(foo1 $f)
      $f
      #end
      #macro(foo2 $e)
      #foo1($e)
      #end
      #foo2($x.abc)

      Would create a log ouput like so:

      ERROR (velocity) Variable $x has not been set at /foo.vm[line 7, column 7]
      ERROR (velocity) Exception calling reference $f at /foo.vm[line 2, column 3]
      ERROR (velocity) Exception in macro #foo1 at /foo.vm[line 5, column 3]
      ERROR (velocity) Exception in macro #foo2 at /foo.vm[line 7, column 1]

      Without this it is very difficult to find where an error occurred within nested macros.

      Attachments

        1. errorLogStackTrace.patch
          5 kB
          Byron Foster

        Activity

          People

            Unassigned Unassigned
            byronvf Byron Foster
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: