summaryrefslogtreecommitdiff
path: root/src/main/java/bjc/rgens/parser/GrammarException.java
diff options
context:
space:
mode:
authorBenjamin J. Culkin <bjculkin@mix.wvu.edu>2018-08-10 10:58:22 -0300
committerBenjamin J. Culkin <bjculkin@mix.wvu.edu>2018-08-10 10:58:22 -0300
commit2acee8f9acf53fd8c1f97f8d40bf0bd6fd53148a (patch)
tree8030a0d292218d1205b9f905945917641dc7eb73 /src/main/java/bjc/rgens/parser/GrammarException.java
parent22ab7a4dd6e608b5ef4d30b1d2ba2816a382dd52 (diff)
Update logging
Logging now uses the RGrammarLogging system so as to allow for better customizability of how the logging works
Diffstat (limited to 'src/main/java/bjc/rgens/parser/GrammarException.java')
-rwxr-xr-xsrc/main/java/bjc/rgens/parser/GrammarException.java34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/main/java/bjc/rgens/parser/GrammarException.java b/src/main/java/bjc/rgens/parser/GrammarException.java
index 9eaa0a1..ea98206 100755
--- a/src/main/java/bjc/rgens/parser/GrammarException.java
+++ b/src/main/java/bjc/rgens/parser/GrammarException.java
@@ -10,6 +10,8 @@ public class GrammarException extends RuntimeException {
/* Serialization ID. */
private static final long serialVersionUID = -7287427479316953668L;
+ private String rootMessage;
+
/**
* Create a new grammar exception with the specified message.
*
@@ -33,4 +35,36 @@ public class GrammarException extends RuntimeException {
public GrammarException(String msg, Exception cause) {
super(msg, cause);
}
+
+ /**
+ * Create a new grammar exception with the specified message.
+ *
+ * @param msg
+ * The message for this exception.
+ */
+ public GrammarException(String msg, String rootMsg) {
+ super(msg);
+
+ this.rootMessage = rootMsg;
+ }
+
+ /**
+ * Create a new grammar exception with the specified message and
+ * cause.
+ *
+ * @param msg
+ * The message for this exception.
+ *
+ * @param cause
+ * The cause of this exception.
+ */
+ public GrammarException(String msg, Exception cause, String rootMsg) {
+ super(msg, cause);
+
+ this.rootMessage = rootMsg;
+ }
+
+ public String getRootMessage() {
+ return rootMessage == null? getMessage() : rootMessage;
+ }
}