I thought it might be useful to return the exception if it's not something that .catchValidationException() can handle. Example:
// server
if (!model.validate()) {
model.throwValidationException();
}
model.save();
return model;
// client
Meteor.call('some-save-method', model, function(error, result) {
error = model.catchValidationException(error);
if (error) {
// do my own handling for a non-validation type exception
return;
}
// no errors, so do something else
alert('success');
});
Otherwise, I don't think there's a way to distinguish when the error is handled by model or not.
Hi,
I thought it might be useful to return the exception if it's not something that
.catchValidationException()
can handle. Example:Otherwise, I don't think there's a way to distinguish when the error is handled by model or not.