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=a3b64613428c465168cb210211ef19010e8570cf;hb=HEAD;hp=ae3bdd87ca368ed06cddf8c42f209ea339c63b1f;hpb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;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 ae3bdd87c..a3b646134 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 @@ -22,6 +22,11 @@ public class InternalCompilerError extends RuntimeException { this.location = Locations.NO_LOCATION; } + public InternalCompilerError(String message, Throwable cause) { + super(message, cause); + this.location = Locations.NO_LOCATION; + } + public InternalCompilerError(long location, String message) { super(message); this.location = location; @@ -31,5 +36,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); + } }