meteor-astronomy: meteor server side method throwing not catched by callback in client

I’ve defined a server side meteor method in a class. I throw a meteor error but the callback in the client side is not catching it.

// code makes no sense just as an example.
// server side

Post.extend({
  addModerator(id) {
    // this error is undefined in the callback parameter.
    throw new Meteor.Error('blabla', 'because blabla');
});

// client side

Post.callMethod('addModerator', id, (err, result) => { console.log(err, result) });

// log result in browser console -> undefined, undefined.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 19 (10 by maintainers)

Most upvoted comments

Ah great! I’m really glad to know that I do understand what I’m doing after all! 😆 Thanks to you!