|
1 // Copyright 2009 the Sputnik authors. All rights reserved. |
|
2 // This code is governed by the BSD license found in the LICENSE file. |
|
3 |
|
4 /** |
|
5 * The production StatementList Statement is evaluated as follows |
|
6 * 1. Evaluate Statement. |
|
7 * 2. If an exception was thrown, return (throw, V, empty) where V is the exception |
|
8 * |
|
9 * @path ch12/12.1/S12.1_A2.js |
|
10 * @description Throwing exception within a Block |
|
11 */ |
|
12 |
|
13 ////////////////////////////////////////////////////////////////////////////// |
|
14 //CHECK#1 |
|
15 try { |
|
16 x(); |
|
17 $ERROR('#1: "x()" lead to throwing exception'); |
|
18 } catch (e) { |
|
19 $PRINT(e.message); |
|
20 } |
|
21 // |
|
22 ////////////////////////////////////////////////////////////////////////////// |
|
23 |
|
24 ////////////////////////////////////////////////////////////////////////////// |
|
25 //CHECK#2 |
|
26 try { |
|
27 throw "catchme"; |
|
28 $ERROR('#2: throw "catchme" lead to throwing exception'); |
|
29 } catch (e) { |
|
30 if (e!=="catchme") { |
|
31 $ERROR('#2.1: Exception === "catchme". Actual: Exception ==='+ e ); |
|
32 } |
|
33 } |
|
34 |
|
35 // |
|
36 ////////////////////////////////////////////////////////////////////////////// |
|
37 |