I would like to propose adding a simple helper for checking type of the error that would be called in the following way:
Meteor.call('methodName', function(err) {
if (ValidationError.isInstance(err)) {
}
});
The issue that it solves is a necessity for checking the error property of the error to make sure that it's a validation error. The problem only occurs when error is throw from the server and we catch it on the client. Even if we throw ValidationError we will receive Meteor.Error on the client, because class constructor is not send over the wire. So we have to make additional check.
I would like to propose adding a simple helper for checking type of the error that would be called in the following way:
The issue that it solves is a necessity for checking the
error
property of the error to make sure that it's a validation error. The problem only occurs when error is throw from the server and we catch it on the client. Even if we throwValidationError
we will receiveMeteor.Error
on the client, because class constructor is not send over the wire. So we have to make additional check.Feel free to change helper name