michael@0: // Copyright 2009 the Sputnik authors. All rights reserved. michael@0: // This code is governed by the BSD license found in the LICENSE file. michael@0: michael@0: /** michael@0: * "try" with "catch" or "finally" statement within/without an "if" statement michael@0: * michael@0: * @path ch12/12.14/S12.14_A8.js michael@0: * @description Throwing exception within an "if" statement michael@0: */ michael@0: michael@0: // CHECK#1 michael@0: var c1=1; michael@0: try{ michael@0: if(c1===1){ michael@0: throw "ex1"; michael@0: $ERROR('#1.1: throw "ex1" lead to throwing exception'); michael@0: } michael@0: $ERROR('#1.2: throw "ex1" inside the "if" statement lead to throwing exception'); michael@0: } michael@0: catch(er1){ michael@0: if (er1!=="ex1") $ERROR('#1.3: Exception ==="ex1". Actual: Exception ==='+er1); michael@0: } michael@0: michael@0: // CHECK#2 michael@0: var c2=1; michael@0: if(c2===1){ michael@0: try{ michael@0: throw "ex1"; michael@0: $ERROR('#2.1: throw "ex1" lead to throwing exception'); michael@0: } michael@0: catch(er1){ michael@0: if(er1!="ex1") $ERROR('#2.2: Exception ==="ex1". Actual: Exception ==='+er1); michael@0: } michael@0: } michael@0: