X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.scl.compiler%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Fcommon%2Fexceptions%2FInternalCompilerError.java;h=1c2709665765562067f185a96bff6ece7243b17a;hb=dac7a40d1cf85956aeac63ccbdf5b7a0d9977ac3;hp=71b6193015b1b4aafb8d9e0cc226131a0f7f928b;hpb=1ec0193a5a5b8f368b03adb24acd762838ddf8ea;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/common/exceptions/InternalCompilerError.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/common/exceptions/InternalCompilerError.java index 71b619301..1c2709665 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/common/exceptions/InternalCompilerError.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/common/exceptions/InternalCompilerError.java @@ -36,5 +36,16 @@ public class InternalCompilerError extends RuntimeException { 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); + } }