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: * Catching system exception with "try" statement michael@0: * michael@0: * @path ch12/12.14/S12.14_A3.js michael@0: * @description Checking if execution of "catch" catches system exceptions michael@0: */ michael@0: michael@0: // CHECK#1 michael@0: try{ michael@0: y; michael@0: $ERROR('#1: "y" lead to throwing exception'); michael@0: } michael@0: catch(e){} michael@0: michael@0: // CHECK#2 michael@0: var c2=0; michael@0: try{ michael@0: try{ michael@0: someValue; michael@0: $ERROR('#3.1: "someValues" lead to throwing exception'); michael@0: } michael@0: finally{ michael@0: c2=1; michael@0: } michael@0: } michael@0: catch(e){ michael@0: if (c2!==1){ michael@0: $ERROR('#3.2: "finally" block must be evaluated'); michael@0: } michael@0: } michael@0: michael@0: // CHECK#3 michael@0: var c3=0,x3=0; michael@0: try{ michael@0: x3=someValue; michael@0: $ERROR('#3.1: "x3=someValues" lead to throwing exception'); michael@0: } michael@0: catch(err){ michael@0: x3=1; michael@0: } michael@0: finally{ michael@0: c3=1; michael@0: } michael@0: if (x3!==1){ michael@0: $ERROR('#3.2: "catch" block must be evaluated'); michael@0: } michael@0: if (c3!==1){ michael@0: $ERROR('#3.3: "finally" block must be evaluated'); michael@0: } michael@0: