|
1 | 1 | <!DOCTYPE html> |
2 | 2 | <html> |
3 | | -<head> |
4 | | - <meta charset="UTF-8" /> |
5 | | - <title>Exception Lab</title> |
6 | | - <style> |
7 | | - #info { |
8 | | - height: 25em; |
9 | | - width: 100%; |
10 | | - } |
11 | | - </style> |
12 | | - <script src="ExceptionLab.js"></script> |
13 | | - <script> |
14 | | - function dumpException(ex) { |
15 | | - ex = ex || new Error("Default error"); |
16 | | - var text = "{\n " + getExceptionProps(ex).join(",\n ") + "\n}"; |
17 | | - document.getElementById("info").innerHTML = text; |
18 | | - } |
| 3 | + <head> |
| 4 | + <meta charset="UTF-8" /> |
| 5 | + <title>Exception Lab</title> |
| 6 | + <style> |
| 7 | + #info { |
| 8 | + height: 25em; |
| 9 | + width: 100%; |
| 10 | + } |
| 11 | + </style> |
| 12 | + <script src="ExceptionLab.js"></script> |
| 13 | + <script> |
| 14 | + document.getElementById("userAgent").innerHTML = navigator.userAgent; |
19 | 15 |
|
20 | | - function dumpException1() { |
21 | | - dumpException(); |
22 | | - } |
| 16 | + function dumpException(ex) { |
| 17 | + ex = ex || new Error("Default error"); |
| 18 | + var text = "{\n " + getExceptionProps(ex).join(",\n ") + "\n}"; |
| 19 | + document.getElementById("info").innerHTML = text; |
| 20 | + } |
23 | 21 |
|
24 | | - function dumpException2() { |
25 | | - try { |
26 | | - undef(); |
27 | | - } catch(ex) { |
28 | | - dumpException(ex); |
| 22 | + function dumpException1() { |
| 23 | + dumpException(); |
29 | 24 | } |
30 | | - } |
31 | 25 |
|
32 | | - function dumpException3() { |
33 | | - dumpException((function(x) { |
| 26 | + function dumpException2() { |
34 | 27 | try { |
35 | | - x.undef(); |
36 | | - } catch(ex) { |
37 | | - return ex; |
| 28 | + undef(); |
| 29 | + } catch (ex) { |
| 30 | + dumpException(ex); |
38 | 31 | } |
39 | | - })(null)); |
40 | | - } |
| 32 | + } |
41 | 33 |
|
42 | | - function createException4() { |
43 | | - return createException(); |
44 | | - } |
| 34 | + function dumpException3() { |
| 35 | + dumpException((function(x) { |
| 36 | + try { |
| 37 | + x.undef(); |
| 38 | + } catch (ex) { |
| 39 | + return ex; |
| 40 | + } |
| 41 | + })(null)); |
| 42 | + } |
45 | 43 |
|
46 | | - function dumpException4() { |
47 | | - dumpException(createException4()); |
48 | | - } |
49 | | - </script> |
50 | | -</head> |
51 | | -<body> |
52 | | - <textarea id="info">Info</textarea><br /> |
53 | | - <button onclick="dumpException1();">Exception 1</button> |
54 | | - <button onclick="dumpException2();">Exception 2</button> |
55 | | - <button onclick="dumpException3();">Exception 3</button> |
56 | | - <button onclick="dumpException4();">Exception 4</button> |
57 | | -</body> |
| 44 | + function createException4() { |
| 45 | + return createException(); |
| 46 | + } |
| 47 | + |
| 48 | + function dumpException4() { |
| 49 | + dumpException(createException4()); |
| 50 | + } |
| 51 | + </script> |
| 52 | + </head> |
| 53 | + <body> |
| 54 | + <span id="userAgent">userAgent</span> |
| 55 | + <script> |
| 56 | + document.getElementById("userAgent").innerHTML = navigator.userAgent; |
| 57 | + </script> |
| 58 | + <textarea id="info">Info</textarea> |
| 59 | + <br/> |
| 60 | + <button onclick="dumpException1();">Exception 1</button> |
| 61 | + <button onclick="dumpException2();">Exception 2</button> |
| 62 | + <button onclick="dumpException3();">Exception 3</button> |
| 63 | + <button onclick="dumpException4();">Exception 4</button> |
| 64 | + </body> |
58 | 65 | </html> |
0 commit comments