1 package polyglot.util; 2 3 4 public class InternalCompilerError extends RuntimeException 5 { 6 Position pos; 7 8 public InternalCompilerError(String msg) { 9 this(msg, (Position)null); 10 } 11 12 public InternalCompilerError(Throwable cause) { 13 this(cause.getMessage(), cause); 14 } 15 16 public InternalCompilerError(String msg, Throwable cause) { 17 this(msg, null, cause); 18 } 19 20 public InternalCompilerError(Position position, String msg) { 21 this(msg, position); 22 } 23 24 public InternalCompilerError(String msg, Position position) { 25 super(msg); 26 pos = position; 27 } 28 public InternalCompilerError(String msg, Position position, Throwable cause) { 29 super(msg, cause); 30 pos = position; 31 } 32 33 public Position position() { 34 return pos; 35 } 36 37 public String message() { 38 return super.getMessage(); 39 } 40 41 public String getMessage() { 42 return pos == null ? message() : pos + ": " + message(); 43 } 44 } 45 | Popular Tags |