| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
package processing.app.debug; |
| 25 |
|
| 26 |
import processing.app.SketchFile; |
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
@SuppressWarnings("serial") |
| 33 |
public class RunnerException extends Exception { |
| 34 |
protected String message; |
| 35 |
protected SketchFile codeFile; |
| 36 |
protected int codeLine; |
| 37 |
protected int codeColumn; |
| 38 |
protected boolean showStackTrace; |
| 39 |
|
| 40 |
|
| 41 |
public RunnerException(String message) { |
| 42 |
this(message, true); |
| 43 |
} |
| 44 |
|
| 45 |
public RunnerException(String message, boolean showStackTrace) { |
| 46 |
this(message, null, -1, -1, showStackTrace); |
| 47 |
} |
| 48 |
|
| 49 |
public RunnerException(String message, SketchFile file, int line) { |
| 50 |
this(message, file, line, -1, true); |
| 51 |
} |
| 52 |
|
| 53 |
|
| 54 |
public RunnerException(String message, SketchFile file, int line, int column) { |
| 55 |
this(message, file, line, column, true); |
| 56 |
} |
| 57 |
|
| 58 |
|
| 59 |
public RunnerException(String message, SketchFile file, int line, int column, |
| 60 |
boolean showStackTrace) { |
| 61 |
this.message = message; |
| 62 |
this.codeFile = file; |
| 63 |
this.codeLine = line; |
| 64 |
this.codeColumn = column; |
| 65 |
this.showStackTrace = showStackTrace; |
| 66 |
} |
| 67 |
|
| 68 |
|
| 69 |
public RunnerException(Exception e) { |
| 70 |
super(e); |
| 71 |
this.showStackTrace = true; |
| 72 |
} |
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
@Override |
| 79 |
public String getMessage() { |
| 80 |
return message; |
| 81 |
} |
| 82 |
|
| 83 |
|
| 84 |
public void setMessage(String message) { |
| 85 |
this.message = message; |
| 86 |
} |
| 87 |
|
| 88 |
|
| 89 |
public SketchFile getCodeFile() { |
| 90 |
return codeFile; |
| 91 |
} |
| 92 |
|
| 93 |
|
| 94 |
public void setCodeFile(SketchFile file) { |
| 95 |
codeFile = file; |
| 96 |
} |
| 97 |
|
| 98 |
public boolean hasCodeFile() { |
| 99 |
return codeFile != null; |
| 100 |
} |
| 101 |
|
| 102 |
|
| 103 |
public int getCodeLine() { |
| 104 |
return codeLine; |
| 105 |
} |
| 106 |
|
| 107 |
|
| 108 |
public void setCodeLine(int line) { |
| 109 |
this.codeLine = line; |
| 110 |
} |
| 111 |
|
| 112 |
public boolean hasCodeLine() { |
| 113 |
return codeLine != -1; |
| 114 |
} |
| 115 |
|
| 116 |
|
| 117 |
public void setCodeColumn(int column) { |
| 118 |
this.codeColumn = column; |
| 119 |
} |
| 120 |
|
| 121 |
public int getCodeColumn() { |
| 122 |
return codeColumn; |
| 123 |
} |
| 124 |
|
| 125 |
|
| 126 |
public void showStackTrace() { |
| 127 |
showStackTrace = true; |
| 128 |
} |
| 129 |
|
| 130 |
|
| 131 |
public void hideStackTrace() { |
| 132 |
showStackTrace = false; |
| 133 |
} |
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
@Override |
| 156 |
public void printStackTrace() { |
| 157 |
if (showStackTrace) { |
| 158 |
super.printStackTrace(); |
| 159 |
} |
| 160 |
} |
| 161 |
} |