Skip to content

Instantly share code, notes, and snippets.

@yankeyhotel
Created July 28, 2015 22:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yankeyhotel/5e5c8e6867b84a06d621 to your computer and use it in GitHub Desktop.
Save yankeyhotel/5e5c8e6867b84a06d621 to your computer and use it in GitHub Desktop.
How to throw an error in a Meteor method
Meteor.methods({
test: function() {
throw new Meteor.Error("name of the error", "Here is the reason");
}
});
Meteor.call('test', function(error, response){
if (error) {
console.log("error", error);
} else {
console.log("response", response);
}
});
@yankeyhotel
Copy link
Author

I use this for testing (Note: this is not how you test).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment