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: * When the [[Call]] property for a Function object F is called, the following steps are taken: michael@0: * 2. Evaluate F's FunctionBody; michael@0: * if Result.type is thrown then Result.value is thrown too michael@0: * michael@0: * @path ch13/13.2/S13.2.1_A8_T1.js michael@0: * @description Throwing an exception within a function body. Declaring function with "function __func()" michael@0: */ michael@0: michael@0: function __func(){ michael@0: var x = 1; michael@0: throw ("Catch Me If You Can") michael@0: return x; michael@0: } michael@0: michael@0: try{ michael@0: var x=__func() michael@0: $ERROR('#0: var x=__func() lead to throwing exception'); michael@0: } catch(e){ michael@0: if (e !== "Catch Me If You Can") { michael@0: $ERROR('#1: Exception === "Catch Me If You Can". Actual: exception ==='+e); michael@0: } michael@0: } michael@0: