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_T2.js michael@0: * @description Throwing an exception within a function body. Declaring function with "var __func = function (message)" michael@0: */ michael@0: michael@0: var CATCH_ME_IF_YOU_CAN = true; michael@0: michael@0: var __func = function (message){ michael@0: var x = 1; michael@0: throw (message) michael@0: return x; michael@0: } michael@0: michael@0: try{ michael@0: var x=__func(CATCH_ME_IF_YOU_CAN) michael@0: $ERROR('#0: var x=__func(CATCH_ME_IF_YOU_CAN) lead to throwing exception'); michael@0: } catch(e){ michael@0: if (!e) { michael@0: $ERROR('#1: Exception === true. Actual: exception ==='+e); michael@0: } michael@0: } michael@0: