matteodem/meteor-easy-security

Throwing errors within Meteor methods hangs page up

epaminond opened this issue · 1 comments

Say I have a simple Meteor method that throws Meteor.Error like this:

easySecurityTest: function() {
  throw new Meteor.Error('Something is wrong (test)');
  return true;
}

I call it on the client like this:

Meteor.call('easySecurityTest', function(err, res) {console.log(err, res)})

After this page wouldn't respond to any actions unless it's reloaded and an exception is reported on server:

I20141206-20:41:17.290(2)? Exception in setTimeout callback: Error: [Something is wrong (test)]
I20141206-20:41:17.292(2)?     at Meteor.methods.easySecurityTest (server/server/server/methods.next.js:37:10)
I20141206-20:41:17.293(2)?     at Object.methods.rateLimit.callFunctionsInQueue (packages/matteodem:easy-security/lib/easy-security.js:72)
I20141206-20:41:17.293(2)?     at packages/matteodem:easy-security/lib/easy-security.js:116
I20141206-20:41:17.294(2)?     at packages/matteodem:easy-security/lib/easy-security.js:92
I20141206-20:41:17.294(2)?     at _.extend.withValue (packages/meteor/dynamics_nodejs.js:56)
I20141206-20:41:17.295(2)?     at packages/meteor/timers.js:6
I20141206-20:41:17.295(2)?     at runWithEnvironment (packages/meteor/dynamics_nodejs.js:108)

This may be related to #2.

I tested this with the leaderboard and it works as expected. Please hand in a reproduction repository for a fix. (I'll open it then again)