aboutsummaryrefslogtreecommitdiff
path: root/velocity-engine-core/src/main/java/org/apache/velocity/exception/VelocityException.java
diff options
context:
space:
mode:
Diffstat (limited to 'velocity-engine-core/src/main/java/org/apache/velocity/exception/VelocityException.java')
-rw-r--r--velocity-engine-core/src/main/java/org/apache/velocity/exception/VelocityException.java39
1 files changed, 39 insertions, 0 deletions
diff --git a/velocity-engine-core/src/main/java/org/apache/velocity/exception/VelocityException.java b/velocity-engine-core/src/main/java/org/apache/velocity/exception/VelocityException.java
index 8dccb151..dc6de702 100644
--- a/velocity-engine-core/src/main/java/org/apache/velocity/exception/VelocityException.java
+++ b/velocity-engine-core/src/main/java/org/apache/velocity/exception/VelocityException.java
@@ -19,6 +19,8 @@ package org.apache.velocity.exception;
* under the License.
*/
+import org.apache.velocity.runtime.parser.LogContext;
+
/**
* Base class for Velocity runtime exceptions thrown to the
* application layer.
@@ -34,6 +36,16 @@ public class VelocityException extends RuntimeException
private static final long serialVersionUID = 1251243065134956045L;
/**
+ * LogContext VTL location tracking context
+ */
+ private LogContext logContext = null;
+
+ /**
+ * VTL vtlStackTrace, populated at construction when runtime.log.track_location is true
+ */
+ private String vtlStackTrace[] = null;
+
+ /**
* @param exceptionMessage The message to register.
*/
public VelocityException(final String exceptionMessage)
@@ -52,6 +64,18 @@ public class VelocityException extends RuntimeException
}
/**
+ * @param exceptionMessage The message to register.
+ * @param wrapped A throwable object that caused the Exception.
+ * @param vtlStackTrace VTL stacktrace
+ * @since 2.2
+ */
+ public VelocityException(final String exceptionMessage, final Throwable wrapped, final String[] vtlStackTrace)
+ {
+ super(exceptionMessage, wrapped);
+ this.vtlStackTrace = vtlStackTrace;
+ }
+
+ /**
* @param wrapped A throwable object that caused the Exception.
* @since 1.5
*/
@@ -61,6 +85,17 @@ public class VelocityException extends RuntimeException
}
/**
+ * @param wrapped A throwable object that caused the Exception.
+ * @param vtlStackTrace VTL stacktrace
+ * @since 2.2
+ */
+ public VelocityException(final Throwable wrapped, final String[] vtlStackTrace)
+ {
+ super(wrapped);
+ this.vtlStackTrace = vtlStackTrace;
+ }
+
+ /**
* returns the wrapped Throwable that caused this
* MethodInvocationException to be thrown
*
@@ -73,4 +108,8 @@ public class VelocityException extends RuntimeException
return getCause();
}
+ public String[] getVtlStackTrace()
+ {
+ return vtlStackTrace;
+ }
}