From 0e22996547f4529ec02079846360abcde535a4de Mon Sep 17 00:00:00 2001 From: Aram Kocharyan Date: Thu, 24 Sep 2015 20:37:02 +1000 Subject: [PATCH 1/2] Check type of `onException` argument to `bindEnvironment` Meteor.bindEnvironment() can have an invalid error handler accidentally passed as the second argument, especially in CoffeeScript where the issue is not easy to find. This can cause a cryptic error message about an exception being thrown when onException() itself is being called. --- packages/meteor/dynamics_nodejs.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/meteor/dynamics_nodejs.js b/packages/meteor/dynamics_nodejs.js index 87156cb56c..1037be8e38 100644 --- a/packages/meteor/dynamics_nodejs.js +++ b/packages/meteor/dynamics_nodejs.js @@ -94,6 +94,8 @@ Meteor.bindEnvironment = function (func, onException, _this) { error && error.stack || error ); }; + } else if (typeof(onException) !== 'function') { + throw new Error('onException argument must be a function, string or undefined for Meteor.bindEnvironment().'); } return function (/* arguments */) { From ff82f5d04f2f4f07f1d208dae1104bff31053439 Mon Sep 17 00:00:00 2001 From: Avital Oliver Date: Tue, 6 Oct 2015 15:08:51 -0700 Subject: [PATCH 2/2] Add History.md entry for #5271 --- History.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/History.md b/History.md index 424ad44a93..b177e1127c 100644 --- a/History.md +++ b/History.md @@ -13,6 +13,8 @@ The complete list can be found [here](https://github.com/meteor/ecmascript-runtime/blob/master/server.js). +* Check type of `onException` argument to `bindEnvironment`. #5271 + ## v1.2.0.2, 2015-Sept-28 * Update Crosswalk plugin for Cordova to 1.3.1. [#5267](https://github.com/meteor/meteor/issues/5267)