OLD | NEW |
(Empty) | |
| 1 function init() |
| 2 { |
| 3 var errorElement = document.getElementById("errorMessage"); |
| 4 errorElement.innerHTML = ""; |
| 5 var settings; |
| 6 try |
| 7 { |
| 8 settings = window.Settings; |
| 9 } |
| 10 catch (e) |
| 11 { |
| 12 errorElement.innerHTML = "Did not instantiate Settings object"; |
| 13 return; |
| 14 } |
| 15 |
| 16 var result1 = document.getElementById("result1"); |
| 17 try |
| 18 { |
| 19 settings.TestBadIndex(0); |
| 20 result1.textContent = "Success"; |
| 21 } |
| 22 catch (e) |
| 23 { |
| 24 result1.textContent = "Failure"; |
| 25 errorElement.innerHTML = "TestBadIndex(0) threw an exception, which is n
ot the expected behavior"; |
| 26 return; |
| 27 } |
| 28 |
| 29 var result2 = document.getElementById("result2"); |
| 30 try |
| 31 { |
| 32 settings.TestBadIndex(1); |
| 33 result2.textContent = "Failure"; |
| 34 errorElement.innerHTML = "TestBadIndex(1) did not throw an exception, wh
ich is not the expected behavior"; |
| 35 return; |
| 36 } |
| 37 catch (e) |
| 38 { |
| 39 result2.textContent = "Success"; |
| 40 indexException = document.getElementById("indexException"); |
| 41 indexException.innerHTML = "Index exception: message = " + e.message + "
, prototype name = " + e.__proto__.name ; |
| 42 } |
| 43 } |
OLD | NEW |