1 package org.simantics.scl.compiler.common.exceptions;
3 import org.simantics.scl.compiler.errors.Locations;
5 public class InternalCompilerError extends RuntimeException {
7 private static final long serialVersionUID = -912160242899559098L;
10 public InternalCompilerError() {
12 this.location = Locations.NO_LOCATION;
15 public InternalCompilerError(long location) {
17 this.location = location;
20 public InternalCompilerError(String message) {
22 this.location = Locations.NO_LOCATION;
25 public InternalCompilerError(String message, Throwable cause) {
26 super(message, cause);
27 this.location = Locations.NO_LOCATION;
30 public InternalCompilerError(long location, String message) {
32 this.location = location;
35 public InternalCompilerError(Throwable cause) {
37 this.location = Locations.NO_LOCATION;
40 public InternalCompilerError(long location, Throwable cause) {
42 this.location = location;
45 public static InternalCompilerError injectLocation(long location, Throwable cause) {
46 if(cause instanceof InternalCompilerError) {
47 InternalCompilerError e = (InternalCompilerError)cause;
48 if(e.location == Locations.NO_LOCATION)
49 e.location = location;
53 return new InternalCompilerError(location, cause);