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(long location, String message) {
27 this.location = location;
30 public InternalCompilerError(Throwable cause) {
32 this.location = Locations.NO_LOCATION;
35 public InternalCompilerError(long location, Throwable cause) {
37 this.location = location;
40 public static InternalCompilerError injectLocation(long location, Throwable cause) {
41 if(cause instanceof InternalCompilerError) {
42 InternalCompilerError e = (InternalCompilerError)cause;
43 if(e.location == Locations.NO_LOCATION)
44 e.location = location;
48 return new InternalCompilerError(location, cause);