Return an error from method

on the client:

Meteor.call('foo', bar, function(error, result) {
  if (error)
    console.log('something went wrong');
});

on the server:

Meteor.methods({
  foo: function(bar) {
    if (test stuff) {
      // works
    } else {
      // return error
    };
  }
});

is there a way to return an error inside the method eg. using the error parameter of the method function?

1 Like

You want Meteor.Error: http://docs.meteor.com/#/full/meteor_error

1 Like