|
1 |
| -/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ |
2 |
| - |
3 |
| -/* |
4 |
| - Part of the Processing project - http://processing.org |
5 |
| -
|
6 |
| - Copyright (c) 2004-08 Ben Fry and Casey Reas |
7 |
| - Copyright (c) 2001-04 Massachusetts Institute of Technology |
8 |
| -
|
9 |
| - This program is free software; you can redistribute it and/or modify |
10 |
| - it under the terms of the GNU General Public License as published by |
11 |
| - the Free Software Foundation; either version 2 of the License, or |
12 |
| - (at your option) any later version. |
13 |
| -
|
14 |
| - This program is distributed in the hope that it will be useful, |
15 |
| - but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 |
| - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17 |
| - GNU General Public License for more details. |
18 |
| -
|
19 |
| - You should have received a copy of the GNU General Public License |
20 |
| - along with this program; if not, write to the Free Software Foundation, |
21 |
| - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
22 |
| -*/ |
| 1 | +// temporary band-aid class to support modes which are still looking here for the now-refactored class. |
| 2 | +// - josh giesbrecht |
23 | 3 |
|
24 | 4 | package processing.app;
|
25 | 5 |
|
| 6 | +@Deprecated |
| 7 | +// please migrate to using processing.utils.SketchException instead! all class functionality is the same as before. |
| 8 | +public class SketchException extends processing.utils.SketchException { |
26 | 9 |
|
27 |
| -/** |
28 |
| - * An exception with a line number attached that occurs |
29 |
| - * during either pre-processing, compile, or run time. |
30 |
| - */ |
31 |
| -public class SketchException extends Exception { |
32 |
| - protected String message; |
33 |
| - protected int codeIndex; |
34 |
| - protected int codeLine; |
35 |
| - protected int codeColumn; |
36 |
| - protected boolean showStackTrace; |
37 |
| - |
38 |
| - |
39 |
| - public SketchException(String message) { |
40 |
| - this(message, true); |
41 |
| - } |
42 |
| - |
43 |
| - |
44 |
| - public SketchException(String message, boolean showStackTrace) { |
45 |
| - this(message, -1, -1, -1, showStackTrace); |
46 |
| - } |
47 |
| - |
48 |
| - |
49 |
| - public SketchException(String message, int file, int line) { |
50 |
| - this(message, file, line, -1, true); |
51 |
| - } |
52 |
| - |
53 |
| - |
54 |
| - public SketchException(String message, int file, int line, int column) { |
55 |
| - this(message, file, line, column, true); |
56 |
| - } |
57 |
| - |
58 |
| - |
59 |
| - public SketchException(String message, int file, int line, int column, |
60 |
| - boolean showStackTrace) { |
61 |
| - this.message = message; |
62 |
| - this.codeIndex = file; |
63 |
| - this.codeLine = line; |
64 |
| - this.codeColumn = column; |
65 |
| - this.showStackTrace = showStackTrace; |
66 |
| - } |
67 |
| - |
68 |
| - |
69 |
| - /** |
70 |
| - * Override getMessage() in Throwable, so that I can set |
71 |
| - * the message text outside the constructor. |
72 |
| - */ |
73 |
| - public String getMessage() { |
74 |
| - return message; |
75 |
| - } |
76 |
| - |
77 |
| - |
78 |
| - public void setMessage(String message) { |
79 |
| - this.message = message; |
80 |
| - } |
81 |
| - |
82 |
| - |
83 |
| - public int getCodeIndex() { |
84 |
| - return codeIndex; |
85 |
| - } |
86 |
| - |
87 |
| - |
88 |
| - public void setCodeIndex(int index) { |
89 |
| - codeIndex = index; |
90 |
| - } |
91 |
| - |
92 |
| - |
93 |
| - public boolean hasCodeIndex() { |
94 |
| - return codeIndex != -1; |
95 |
| - } |
96 |
| - |
97 |
| - |
98 |
| - public int getCodeLine() { |
99 |
| - return codeLine; |
100 |
| - } |
101 |
| - |
102 |
| - |
103 |
| - public void setCodeLine(int line) { |
104 |
| - this.codeLine = line; |
105 |
| - } |
106 |
| - |
107 |
| - |
108 |
| - public boolean hasCodeLine() { |
109 |
| - return codeLine != -1; |
110 |
| - } |
111 |
| - |
112 |
| - |
113 |
| - public void setCodeColumn(int column) { |
114 |
| - this.codeColumn = column; |
115 |
| - } |
116 |
| - |
117 |
| - |
118 |
| - public int getCodeColumn() { |
119 |
| - return codeColumn; |
120 |
| - } |
121 |
| - |
122 |
| - |
123 |
| - public void showStackTrace() { |
124 |
| - showStackTrace = true; |
125 |
| - } |
126 |
| - |
127 |
| - |
128 |
| - public void hideStackTrace() { |
129 |
| - showStackTrace = false; |
130 |
| - } |
131 |
| - |
132 |
| - |
133 |
| - public boolean isStackTraceEnabled() { |
134 |
| - return showStackTrace; |
135 |
| - } |
| 10 | + // Idea complained without all these super wrappers for constructors. ¯\_(ツ)_/¯ sure, why not? |
| 11 | + public SketchException(String message) { |
| 12 | + super(message); |
| 13 | + } |
136 | 14 |
|
| 15 | + public SketchException(String message, boolean showStackTrace) { |
| 16 | + super(message, showStackTrace); |
| 17 | + } |
137 | 18 |
|
138 |
| - /** |
139 |
| - * Nix the java.lang crap out of an exception message |
140 |
| - * because it scares the children. |
141 |
| - * <P> |
142 |
| - * This function must be static to be used with super() |
143 |
| - * in each of the constructors above. |
144 |
| - */ |
145 |
| - /* |
146 |
| - static public final String massage(String msg) { |
147 |
| - if (msg.indexOf("java.lang.") == 0) { |
148 |
| - //int dot = msg.lastIndexOf('.'); |
149 |
| - msg = msg.substring("java.lang.".length()); |
| 19 | + public SketchException(String message, int file, int line) { |
| 20 | + super(message, file, line); |
150 | 21 | }
|
151 |
| - return msg; |
152 |
| - //return (dot == -1) ? msg : msg.substring(dot+1); |
153 |
| - } |
154 |
| - */ |
155 | 22 |
|
| 23 | + public SketchException(String message, int file, int line, int column) { |
| 24 | + super(message, file, line, column); |
| 25 | + } |
156 | 26 |
|
157 |
| - public void printStackTrace() { |
158 |
| - if (showStackTrace) { |
159 |
| - super.printStackTrace(); |
| 27 | + public SketchException(String message, int file, int line, int column, boolean showStackTrace) { |
| 28 | + super(message, file, line, column, showStackTrace); |
160 | 29 | }
|
161 |
| - } |
162 | 30 | }
|
0 commit comments