]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/common/exceptions/InternalCompilerError.java
Merge "Tons of dependency fixes and updates"
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / common / exceptions / InternalCompilerError.java
1 package org.simantics.scl.compiler.common.exceptions;
2
3 import org.simantics.scl.compiler.errors.Locations;
4
5 public class InternalCompilerError extends RuntimeException {
6
7     private static final long serialVersionUID = -912160242899559098L;
8     public long location;
9     
10     public InternalCompilerError() {
11         super();
12         this.location = Locations.NO_LOCATION;
13     }
14     
15     public InternalCompilerError(long location) {
16         super();
17         this.location = location;
18     }
19
20     public InternalCompilerError(String message) {
21         super(message);
22         this.location = Locations.NO_LOCATION;
23     }
24     
25     public InternalCompilerError(String message, Throwable cause) {
26         super(message, cause);
27         this.location = Locations.NO_LOCATION;
28     }
29     
30     public InternalCompilerError(long location, String message) {
31         super(message);
32         this.location = location;
33     }
34
35     public InternalCompilerError(Throwable cause) {
36         super(cause);
37         this.location = Locations.NO_LOCATION;
38     }
39     
40     public InternalCompilerError(long location, Throwable cause) {
41         super(cause);
42         this.location = location;
43     }
44     
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;
50             return e;
51         }
52         else
53             return new InternalCompilerError(location, cause);
54     }
55    
56 }