I am throwing a Meteor.Error with a custom [reason] like this:
if (Meteor.isServer) {
Accounts.onCreateUser(function(options, user) {
...
if (emailAlreadyExist === true) {
throw new Meteor.Error(403, "email already registered");
} else {
retu user
}
})
}
then trying to show this error message to the user:
if (Meteor.isClient) {
...
if (error) {
// Inform the user that account creation failed
sAlert.error(error.reason);
}
...
}
But this alert does not show my custom Meteor.Error [reason], it always gives me "Email already exists". What I am doing wrong?
