Wed, 31 Dec 2014 13:27:57 +0100
Ignore runtime configuration files generated during quality assurance.
1 // Copyright 2009 the Sputnik authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
4 /**
5 * Catching system exceptions of different types with try statement
6 *
7 * @path ch12/12.14/S12.14_A19_T1.js
8 * @description Testing try/catch syntax construction
9 */
11 // CHECK#1
12 try{
13 throw (Error("hello"));
14 }
15 catch(e){
16 if (e.toString()!=="Error: hello") $ERROR('#1: Exception.toString()==="Error: hello". Actual: Exception is '+e);
17 }
19 // CHECK#2
20 try{
21 throw (new Error("hello"));
22 }
23 catch(e){
24 if (e.toString()!=="Error: hello") $ERROR('#2: Exception.toString()==="Error: hello". Actual: Exception is '+e);
25 }
27 // CHECK#3
28 var c3=0;
29 try{
30 throw EvalError(1);
31 }
32 catch(e){
33 if (e.toString()!=="EvalError: 1") $ERROR('#3: Exception.toString()==="EvalError: 1". Actual: Exception is '+e);
34 }
36 // CHECK#4
37 try{
38 throw RangeError(1);
39 }
40 catch(e){
41 if (e.toString()!=="RangeError: 1") $ERROR('#4: Exception.toString()==="RangeError: 1". Actual: Exception is '+e);
42 }
44 // CHECK#5
45 try{
46 throw ReferenceError(1);
47 }
48 catch(e){
49 if (e.toString()!=="ReferenceError: 1") $ERROR('#5: Exception.toString()==="ReferenceError: 1". Actual: Exception is '+e);
50 }
52 // CHECK#6
53 var c6=0;
54 try{
55 throw TypeError(1);
56 }
57 catch(e){
58 if (e.toString()!=="TypeError: 1") $ERROR('#6: Exception.toString()==="TypeError: 1". Actual: Exception is '+e);
59 }
61 // CHECK#7
62 try{
63 throw URIError("message", "fileName", "1");
64 }
65 catch(e){
66 if (e.toString()!=="URIError: message") $ERROR('#7: Exception.toString()==="URIError: message". Actual: Exception is '+e);
67 }