Skip to content

Commit bfc43f9

Browse files
committed
more details for errors
1 parent bafa0c7 commit bfc43f9

File tree

2 files changed

+29
-29
lines changed

2 files changed

+29
-29
lines changed

src/test/java/org/htmlunit/WebDriverTestCase.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -148,22 +148,22 @@ public abstract class WebDriverTestCase extends WebTestCase {
148148
private static final String LOG_EX_FUNCTION =
149149
" function logEx(e) {\n"
150150
+ " let toStr = null;\n"
151-
+ " if (toStr === null && e instanceof EvalError) { toStr = 'EvalError'; }\n"
152-
+ " if (toStr === null && e instanceof RangeError) { toStr = 'RangeError'; }\n"
153-
+ " if (toStr === null && e instanceof ReferenceError) { toStr = 'ReferenceError'; }\n"
154-
+ " if (toStr === null && e instanceof SyntaxError) { toStr = 'SyntaxError'; }\n"
155-
+ " if (toStr === null && e instanceof TypeError) { toStr = 'TypeError'; }\n"
156-
+ " if (toStr === null && e instanceof URIError) { toStr = 'URIError'; }\n"
157-
+ " if (toStr === null && e instanceof AggregateError) { toStr = 'AggregateError'; }\n"
151+
+ " if (toStr === null && e instanceof EvalError) { toStr = ''; }\n"
152+
+ " if (toStr === null && e instanceof RangeError) { toStr = ''; }\n"
153+
+ " if (toStr === null && e instanceof ReferenceError) { toStr = ''; }\n"
154+
+ " if (toStr === null && e instanceof SyntaxError) { toStr = ''; }\n"
155+
+ " if (toStr === null && e instanceof TypeError) { toStr = ''; }\n"
156+
+ " if (toStr === null && e instanceof URIError) { toStr = ''; }\n"
157+
+ " if (toStr === null && e instanceof AggregateError) { toStr = '/AggregateError'; }\n"
158158
+ " if (toStr === null && typeof InternalError == 'function' "
159-
+ "&& e instanceof InternalError) { toStr = 'InternalError'; }\n"
159+
+ "&& e instanceof InternalError) { toStr = '/InternalError'; }\n"
160160
+ " if (toStr === null) {\n"
161161
+ " let rx = /\\[object (.*)\\]/;\n"
162162
+ " toStr = Object.prototype.toString.call(e);\n"
163163
+ " let match = rx.exec(toStr);\n"
164-
+ " if (match != null) { toStr = match[1]; }\n"
164+
+ " if (match != null) { toStr = '/' + match[1]; }\n"
165165
+ " }"
166-
+ " log(e.name + '/' + toStr);\n"
166+
+ " log(e.name + toStr);\n"
167167
+ "}\n";
168168

169169
/**

src/test/java/org/htmlunit/javascript/ErrorTest.java

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ public void error() throws Exception {
6767
*/
6868
@Test
6969
@Alerts(DEFAULT = {"EvalError", "Whoops!", "undefined", "undefined", "undefined",
70-
"undefined", "true", "true", "EvalError/EvalError"},
70+
"undefined", "true", "true", "EvalError"},
7171
FF = {"EvalError", "Whoops!", "undefined", "11", "undefined", "25",
72-
"true", "true", "EvalError/EvalError"},
72+
"true", "true", "EvalError"},
7373
FF_ESR = {"EvalError", "Whoops!", "undefined", "11", "undefined", "25",
74-
"true", "true", "EvalError/EvalError"})
74+
"true", "true", "EvalError"})
7575
public void evalError() throws Exception {
7676
final String html
7777
= "<html>\n"
@@ -104,11 +104,11 @@ public void evalError() throws Exception {
104104
*/
105105
@Test
106106
@Alerts(DEFAULT = {"RangeError", "Whoops!", "undefined", "undefined", "undefined",
107-
"undefined", "true", "true", "RangeError/RangeError"},
107+
"undefined", "true", "true", "RangeError"},
108108
FF = {"RangeError", "Whoops!", "undefined", "11", "undefined", "25",
109-
"true", "true", "RangeError/RangeError"},
109+
"true", "true", "RangeError"},
110110
FF_ESR = {"RangeError", "Whoops!", "undefined", "11", "undefined", "25",
111-
"true", "true", "RangeError/RangeError"})
111+
"true", "true", "RangeError"})
112112
public void rangeError() throws Exception {
113113
final String html
114114
= "<html>\n"
@@ -141,11 +141,11 @@ public void rangeError() throws Exception {
141141
*/
142142
@Test
143143
@Alerts(DEFAULT = {"ReferenceError", "Whoops!", "undefined", "undefined", "undefined",
144-
"undefined", "true", "true", "ReferenceError/ReferenceError"},
144+
"undefined", "true", "true", "ReferenceError"},
145145
FF = {"ReferenceError", "Whoops!", "undefined", "11", "undefined", "25",
146-
"true", "true", "ReferenceError/ReferenceError"},
146+
"true", "true", "ReferenceError"},
147147
FF_ESR = {"ReferenceError", "Whoops!", "undefined", "11", "undefined", "25",
148-
"true", "true", "ReferenceError/ReferenceError"})
148+
"true", "true", "ReferenceError"})
149149
public void referenceError() throws Exception {
150150
final String html
151151
= "<html>\n"
@@ -178,11 +178,11 @@ public void referenceError() throws Exception {
178178
*/
179179
@Test
180180
@Alerts(DEFAULT = {"SyntaxError", "Whoops!", "undefined", "undefined", "undefined",
181-
"undefined", "true", "true", "SyntaxError/SyntaxError"},
181+
"undefined", "true", "true", "SyntaxError"},
182182
FF = {"SyntaxError", "Whoops!", "undefined", "11", "undefined", "25",
183-
"true", "true", "SyntaxError/SyntaxError"},
183+
"true", "true", "SyntaxError"},
184184
FF_ESR = {"SyntaxError", "Whoops!", "undefined", "11", "undefined", "25",
185-
"true", "true", "SyntaxError/SyntaxError"})
185+
"true", "true", "SyntaxError"})
186186
public void syntaxError() throws Exception {
187187
final String html
188188
= "<html>\n"
@@ -215,11 +215,11 @@ public void syntaxError() throws Exception {
215215
*/
216216
@Test
217217
@Alerts(DEFAULT = {"TypeError", "Whoops!", "undefined", "undefined", "undefined",
218-
"undefined", "true", "true", "TypeError/TypeError"},
218+
"undefined", "true", "true", "TypeError"},
219219
FF = {"TypeError", "Whoops!", "undefined", "11", "undefined", "25",
220-
"true", "true", "TypeError/TypeError"},
220+
"true", "true", "TypeError"},
221221
FF_ESR = {"TypeError", "Whoops!", "undefined", "11", "undefined", "25",
222-
"true", "true", "TypeError/TypeError"})
222+
"true", "true", "TypeError"})
223223
public void typeError() throws Exception {
224224
final String html
225225
= "<html>\n"
@@ -252,11 +252,11 @@ public void typeError() throws Exception {
252252
*/
253253
@Test
254254
@Alerts(DEFAULT = {"URIError", "Whoops!", "undefined", "undefined", "undefined",
255-
"undefined", "true", "true", "URIError/URIError"},
255+
"undefined", "true", "true", "URIError"},
256256
FF = {"URIError", "Whoops!", "undefined", "11", "undefined", "25",
257-
"true", "true", "URIError/URIError"},
257+
"true", "true", "URIError"},
258258
FF_ESR = {"URIError", "Whoops!", "undefined", "11", "undefined", "25",
259-
"true", "true", "URIError/URIError"})
259+
"true", "true", "URIError"})
260260
public void uriError() throws Exception {
261261
final String html
262262
= "<html>\n"
@@ -331,7 +331,7 @@ public void aggregateError() throws Exception {
331331
@Test
332332
@Alerts(DEFAULT = {"ReferenceError", "InternalError is not defined",
333333
"undefined", "undefined", "undefined",
334-
"undefined", "true", "false", "ReferenceError/ReferenceError"},
334+
"undefined", "true", "false", "ReferenceError"},
335335
FF = {"InternalError", "Whoops!", "undefined", "11", "undefined", "25",
336336
"true", "true", "InternalError/InternalError"},
337337
FF_ESR = {"InternalError", "Whoops!", "undefined", "11", "undefined", "25",

0 commit comments

Comments
 (0)