Skip to content

Commit 546f452

Browse files
committed
more on error handling
1 parent 4b9a737 commit 546f452

File tree

8 files changed

+95
-95
lines changed

8 files changed

+95
-95
lines changed

src/test/java/org/htmlunit/javascript/host/css/CSSImportRuleTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public void cssTextSet() throws Exception {
114114
+ " rule.cssText = '@import \"imp2.css\";';\n"
115115
+ " log(rule.cssText);\n"
116116
+ " } catch(e) {\n"
117-
+ " log('exception');\n"
117+
+ " log(e.name);\n"
118118
+ " }\n"
119119
+ "</script>\n"
120120

@@ -175,7 +175,7 @@ public void parentRuleSet() throws Exception {
175175
+ " rule.parentRule = rule;\n"
176176
+ " log(rule.parentRule);\n"
177177
+ " } catch(e) {\n"
178-
+ " log('exception');\n"
178+
+ " log(e.name);\n"
179179
+ " }\n"
180180
+ "</script>\n"
181181

@@ -236,7 +236,7 @@ public void parentStyleSheetSet() throws Exception {
236236
+ " rule.parentStyleSheet = null;\n"
237237
+ " log(rule.parentStyleSheet);\n"
238238
+ " } catch(e) {\n"
239-
+ " log('exception');\n"
239+
+ " log(e.name);\n"
240240
+ " }\n"
241241
+ "</script>\n"
242242

src/test/java/org/htmlunit/javascript/host/css/CSSMediaRuleTest.java

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ public void cssTextSet() throws Exception {
197197
+ " rule.cssText = '@media screen { span { color: rgb(0, 0, 0); }}';\n"
198198
+ " log(rule.cssText);\n"
199199
+ " } catch(e) {\n"
200-
+ " log('exception');\n"
200+
+ " log(e.name);\n"
201201
+ " }\n"
202202
+ "</script>\n"
203203

@@ -280,7 +280,7 @@ public void parentRuleSet() throws Exception {
280280
+ " rule.parentRule = rule;\n"
281281
+ " log(rule.parentRule);\n"
282282
+ " } catch(e) {\n"
283-
+ " log('exception');\n"
283+
+ " log(e.name);\n"
284284
+ " }\n"
285285
+ "</script>\n"
286286

@@ -335,7 +335,7 @@ public void parentStyleSheetSet() throws Exception {
335335
+ " rule.parentStyleSheet = null;\n"
336336
+ " log(rule.parentStyleSheet);\n"
337337
+ " } catch(e) {\n"
338-
+ " log('exception');\n"
338+
+ " log(e.name);\n"
339339
+ " }\n"
340340
+ "</script>\n"
341341

@@ -540,7 +540,7 @@ public void insertRule() throws Exception {
540540
+ " log(rules.item(i).parentRule);\n"
541541
+ " }\n"
542542
+ " } catch(e) {\n"
543-
+ " log('exception');\n"
543+
+ " log(e.name);\n"
544544
+ " }\n"
545545
+ "</script>\n"
546546

@@ -553,7 +553,7 @@ public void insertRule() throws Exception {
553553
* @throws Exception if an error occurs
554554
*/
555555
@Test
556-
@Alerts("exception")
556+
@Alerts("SyntaxError")
557557
public void insertRuleNull() throws Exception {
558558
final String html
559559
= "<html><body>\n"
@@ -570,7 +570,7 @@ public void insertRuleNull() throws Exception {
570570
+ " try {\n"
571571
+ " rule.insertRule(null);\n"
572572
+ " } catch(e) {\n"
573-
+ " log('exception');\n"
573+
+ " log(e.name);\n"
574574
+ " }\n"
575575
+ "</script>\n"
576576

@@ -583,7 +583,7 @@ public void insertRuleNull() throws Exception {
583583
* @throws Exception if an error occurs
584584
*/
585585
@Test
586-
@Alerts("exception")
586+
@Alerts("SyntaxError")
587587
public void insertRuleEmpty() throws Exception {
588588
final String html
589589
= "<html><body>\n"
@@ -600,7 +600,7 @@ public void insertRuleEmpty() throws Exception {
600600
+ " try {\n"
601601
+ " rule.insertRule('');\n"
602602
+ " } catch(e) {\n"
603-
+ " log('exception');\n"
603+
+ " log(e.name);\n"
604604
+ " }\n"
605605
+ "</script>\n"
606606

@@ -613,7 +613,7 @@ public void insertRuleEmpty() throws Exception {
613613
* @throws Exception if an error occurs
614614
*/
615615
@Test
616-
@Alerts("exception")
616+
@Alerts("SyntaxError")
617617
public void insertRuleInvalid() throws Exception {
618618
final String html
619619
= "<html><body>\n"
@@ -630,7 +630,7 @@ public void insertRuleInvalid() throws Exception {
630630
+ " try {\n"
631631
+ " rule.insertRule('%ab');\n"
632632
+ " } catch(e) {\n"
633-
+ " log('exception');\n"
633+
+ " log(e.name);\n"
634634
+ " }\n"
635635
+ "</script>\n"
636636

@@ -667,7 +667,7 @@ public void insertRuleWithIndex() throws Exception {
667667
+ " log(rules.item(i).parentRule);\n"
668668
+ " }\n"
669669
+ " } catch(e) {\n"
670-
+ " log('exception');\n"
670+
+ " log(e.name);\n"
671671
+ " }\n"
672672
+ "</script>\n"
673673

@@ -680,7 +680,7 @@ public void insertRuleWithIndex() throws Exception {
680680
* @throws Exception if an error occurs
681681
*/
682682
@Test
683-
@Alerts("exception")
683+
@Alerts("SyntaxError")
684684
public void insertRuleNullWithIndex() throws Exception {
685685
final String html
686686
= "<html><body>\n"
@@ -697,7 +697,7 @@ public void insertRuleNullWithIndex() throws Exception {
697697
+ " try {\n"
698698
+ " rule.insertRule(null, 1);\n"
699699
+ " } catch(e) {\n"
700-
+ " log('exception');\n"
700+
+ " log(e.name);\n"
701701
+ " }\n"
702702
+ "</script>\n"
703703

@@ -710,7 +710,7 @@ public void insertRuleNullWithIndex() throws Exception {
710710
* @throws Exception if an error occurs
711711
*/
712712
@Test
713-
@Alerts({"1", "exception"})
713+
@Alerts({"1", "SyntaxError"})
714714
public void insertRuleEmptyWithIndex() throws Exception {
715715
final String html
716716
= "<html><body>\n"
@@ -733,7 +733,7 @@ public void insertRuleEmptyWithIndex() throws Exception {
733733
+ " log(rules.item(i).parentRule);\n"
734734
+ " }\n"
735735
+ " } catch(e) {\n"
736-
+ " log('exception');\n"
736+
+ " log(e.name);\n"
737737
+ " }\n"
738738
+ "</script>\n"
739739

@@ -746,7 +746,7 @@ public void insertRuleEmptyWithIndex() throws Exception {
746746
* @throws Exception if an error occurs
747747
*/
748748
@Test
749-
@Alerts("exception")
749+
@Alerts("SyntaxError")
750750
public void insertRuleInvalidWithIndex() throws Exception {
751751
final String html
752752
= "<html><body>\n"
@@ -763,7 +763,7 @@ public void insertRuleInvalidWithIndex() throws Exception {
763763
+ " try {\n"
764764
+ " rule.insertRule('%ab', 1);\n"
765765
+ " } catch(e) {\n"
766-
+ " log('exception');\n"
766+
+ " log(e.name);\n"
767767
+ " }\n"
768768
+ "</script>\n"
769769

@@ -850,7 +850,7 @@ public void insertRuleWithIndexNaN() throws Exception {
850850
* @throws Exception if an error occurs
851851
*/
852852
@Test
853-
@Alerts({"1", "exception"})
853+
@Alerts({"1", "IndexSizeError"})
854854
public void insertRuleWithIndexNegative() throws Exception {
855855
final String html
856856
= "<html><body>\n"
@@ -868,7 +868,7 @@ public void insertRuleWithIndexNegative() throws Exception {
868868
+ " try {\n"
869869
+ " rule.insertRule('span { color:#000000; }', 2);\n"
870870
+ " } catch(e) {\n"
871-
+ " log('exception');\n"
871+
+ " log(e.name);\n"
872872
+ " }\n"
873873
+ "</script>\n"
874874

@@ -881,7 +881,7 @@ public void insertRuleWithIndexNegative() throws Exception {
881881
* @throws Exception if an error occurs
882882
*/
883883
@Test
884-
@Alerts({"1", "exception"})
884+
@Alerts({"1", "IndexSizeError"})
885885
public void insertRuleWithIndexGreaterThanLength() throws Exception {
886886
final String html
887887
= "<html><body>\n"
@@ -899,7 +899,7 @@ public void insertRuleWithIndexGreaterThanLength() throws Exception {
899899
+ " try {\n"
900900
+ " rule.insertRule('span { color:#000000; }', 2);\n"
901901
+ " } catch(e) {\n"
902-
+ " log('exception');\n"
902+
+ " log(e.name);\n"
903903
+ " }\n"
904904
+ "</script>\n"
905905

@@ -934,7 +934,7 @@ public void deleteRule() throws Exception {
934934
+ " log(rules.item(i).cssText);\n"
935935
+ " }\n"
936936
+ " } catch(e) {\n"
937-
+ " log('exception');\n"
937+
+ " log(e.name);\n"
938938
+ " }\n"
939939
+ "</script>\n"
940940

@@ -969,7 +969,7 @@ public void deleteRuleNull() throws Exception {
969969
+ " log(rules.item(i).cssText);\n"
970970
+ " }\n"
971971
+ " } catch(e) {\n"
972-
+ " log('exception');\n"
972+
+ " log(e.name);\n"
973973
+ " }\n"
974974
+ "</script>\n"
975975

@@ -1004,7 +1004,7 @@ public void deleteRuleNaN() throws Exception {
10041004
+ " log(rules.item(i).cssText);\n"
10051005
+ " }\n"
10061006
+ " } catch(e) {\n"
1007-
+ " log('exception');\n"
1007+
+ " log(e.name);\n"
10081008
+ " }\n"
10091009
+ "</script>\n"
10101010

@@ -1017,7 +1017,7 @@ public void deleteRuleNaN() throws Exception {
10171017
* @throws Exception if an error occurs
10181018
*/
10191019
@Test
1020-
@Alerts({"2", "exception"})
1020+
@Alerts({"2", "IndexSizeError"})
10211021
public void deleteRuleNegative() throws Exception {
10221022
final String html
10231023
= "<html><body>\n"
@@ -1035,7 +1035,7 @@ public void deleteRuleNegative() throws Exception {
10351035
+ " try {\n"
10361036
+ " rule.deleteRule(-1);\n"
10371037
+ " } catch(e) {\n"
1038-
+ " log('exception');\n"
1038+
+ " log(e.name);\n"
10391039
+ " }\n"
10401040
+ "</script>\n"
10411041

@@ -1048,7 +1048,7 @@ public void deleteRuleNegative() throws Exception {
10481048
* @throws Exception if an error occurs
10491049
*/
10501050
@Test
1051-
@Alerts({"2", "exception"})
1051+
@Alerts({"2", "IndexSizeError"})
10521052
public void deleteRuleGreaterThanLength() throws Exception {
10531053
final String html
10541054
= "<html><body>\n"
@@ -1066,7 +1066,7 @@ public void deleteRuleGreaterThanLength() throws Exception {
10661066
+ " try {\n"
10671067
+ " rule.deleteRule(2);\n"
10681068
+ " } catch(e) {\n"
1069-
+ " log('exception');\n"
1069+
+ " log(e.name);\n"
10701070
+ " }\n"
10711071
+ "</script>\n"
10721072

src/test/java/org/htmlunit/javascript/host/css/CSSPageRuleTest.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public void cssTextSet() throws Exception {
164164
+ " rule.cssText = '@page { margin: 2cm; }';\n"
165165
+ " log(rule.cssText);\n"
166166
+ " } catch(e) {\n"
167-
+ " log('exception');\n"
167+
+ " log(e.name);\n"
168168
+ " }\n"
169169
+ "</script>\n"
170170

@@ -219,7 +219,7 @@ public void parentRuleSet() throws Exception {
219219
+ " rule.parentRule = rule;\n"
220220
+ " log(rule.parentRule);\n"
221221
+ " } catch(e) {\n"
222-
+ " log('exception');\n"
222+
+ " log(e.name);\n"
223223
+ " }\n"
224224
+ "</script>\n"
225225

@@ -274,7 +274,7 @@ public void parentStyleSheetSet() throws Exception {
274274
+ " rule.parentStyleSheet = null;\n"
275275
+ " log(rule.parentStyleSheet);\n"
276276
+ " } catch(e) {\n"
277-
+ " log('exception');\n"
277+
+ " log(e.name);\n"
278278
+ " }\n"
279279
+ "</script>\n"
280280

@@ -303,7 +303,7 @@ public void selectorTextEmpty() throws Exception {
303303
+ " try {"
304304
+ " log(rule.selectorText);\n"
305305
+ " } catch(e) {\n"
306-
+ " log('exception');\n"
306+
+ " log(e.name);\n"
307307
+ " }\n"
308308
+ "</script>\n"
309309

@@ -332,7 +332,7 @@ public void selectorText() throws Exception {
332332
+ " try {"
333333
+ " log(rule.selectorText);\n"
334334
+ " } catch(e) {\n"
335-
+ " log('exception');\n"
335+
+ " log(e.name);\n"
336336
+ " }\n"
337337
+ "</script>\n"
338338

@@ -361,7 +361,7 @@ public void selectorTextCaseInsensitive() throws Exception {
361361
+ " try {"
362362
+ " log(rule.selectorText);\n"
363363
+ " } catch(e) {\n"
364-
+ " log('exception');\n"
364+
+ " log(e.name);\n"
365365
+ " }\n"
366366
+ "</script>\n"
367367

@@ -392,7 +392,7 @@ public void selectorTextSet() throws Exception {
392392
+ " rule.selectorText = ':left';\n"
393393
+ " log(rule.selectorText);\n"
394394
+ " } catch(e) {\n"
395-
+ " log('exception');\n"
395+
+ " log(e.name);\n"
396396
+ " }\n"
397397
+ "</script>\n"
398398

@@ -423,7 +423,7 @@ public void selectorTextSetNull() throws Exception {
423423
+ " rule.selectorText = null;\n"
424424
+ " log(rule.selectorText);\n"
425425
+ " } catch(e) {\n"
426-
+ " log('exception');\n"
426+
+ " log(e.name);\n"
427427
+ " }\n"
428428
+ "</script>\n"
429429

@@ -454,7 +454,7 @@ public void selectorTextSetEmpty() throws Exception {
454454
+ " rule.selectorText = '';\n"
455455
+ " log(rule.selectorText);\n"
456456
+ " } catch(e) {\n"
457-
+ " log('exception');\n"
457+
+ " log(e.name);\n"
458458
+ " }\n"
459459
+ "</script>\n"
460460

@@ -485,7 +485,7 @@ public void selectorTextSetInvalid() throws Exception {
485485
+ " rule.selectorText = ':grey';\n"
486486
+ " log(rule.selectorText);\n"
487487
+ " } catch(e) {\n"
488-
+ " log('exception');\n"
488+
+ " log(e.name);\n"
489489
+ " }\n"
490490
+ "</script>\n"
491491

@@ -516,7 +516,7 @@ public void selectorTextSetCaseInsensitive() throws Exception {
516516
+ " rule.selectorText = ':LeFt';\n"
517517
+ " log(rule.selectorText);\n"
518518
+ " } catch(e) {\n"
519-
+ " log('exception');\n"
519+
+ " log(e.name);\n"
520520
+ " }\n"
521521
+ "</script>\n"
522522

0 commit comments

Comments
 (0)