Added line number to error messages.
[controller.git] / opendaylight / sal / yang-prototype / code-generator / yang-model-parser-impl / src / main / java / org / opendaylight / controller / yang / model / parser / util / YangParseException.java
index 331869a0f7f66fb27dd938b2d30e3b30e81d7ce1..301e5332f8d7cc38b1066c4998d9d0135488d02a 100644 (file)
@@ -11,12 +11,33 @@ public class YangParseException extends RuntimeException {
 
     private static final long serialVersionUID = 1239548963471793178L;
 
-    public YangParseException(String errorMsg) {
+    public YangParseException(final String errorMsg) {
         super(errorMsg);
     }
 
-    public YangParseException(String errorMsg, Exception exception) {
+    public YangParseException(final String errorMsg, final Exception exception) {
         super(errorMsg, exception);
     }
 
+    public YangParseException(final int line, final String errorMsg) {
+        super("Error on line " + line + ": " + errorMsg);
+    }
+
+    public YangParseException(final int line, final String errorMsg,
+            final Exception exception) {
+        super("Error on line " + line + ": " + errorMsg, exception);
+    }
+
+    public YangParseException(final String moduleName, final int line,
+            final String errorMsg) {
+        super("Error in module '" + moduleName + "' on line " + line + ": "
+                + errorMsg);
+    }
+
+    public YangParseException(final String moduleName, final int line,
+            final String errorMsg, final Exception exception) {
+        super("Error in module '" + moduleName + "' on line " + line + ": "
+                + errorMsg, exception);
+    }
+
 }