]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/common/exceptions/InternalCompilerError.java
Expose CommandSession in SCL
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / common / exceptions / InternalCompilerError.java
old mode 100755 (executable)
new mode 100644 (file)
index ae3bdd8..1c27096
@@ -31,5 +31,21 @@ public class InternalCompilerError extends RuntimeException {
         super(cause);
         this.location = Locations.NO_LOCATION;
     }
+    
+    public InternalCompilerError(long location, Throwable cause) {
+        super(cause);
+        this.location = location;
+    }
+    
+    public static InternalCompilerError injectLocation(long location, Throwable cause) {
+        if(cause instanceof InternalCompilerError) {
+            InternalCompilerError e = (InternalCompilerError)cause;
+            if(e.location == Locations.NO_LOCATION)
+                e.location = location;
+            return e;
+        }
+        else
+            return new InternalCompilerError(location, cause);
+    }
    
 }