Mdg:validdation-error get error

I am trying to use mdg:validdation-error.
I can generate the ValidationError but the thrown error is not returning as something that I can process.

for exemple:
methods.js

// method name,
validate(doc){
		if (doc.name.length === 0){
			throw new ValidationError([
			 {
				 name: 'name',
				 type: 'must have value',
				 value: doc.name,
			 }
		 ]);
		}
  },
  // reset of the method

addList-form.js

insert.call(doc, (err, rers) => {
  if (err) {
     console.log('has validating err')
  }
})

but it isn’t printed to the console:

Does someone sees what am I doing wrong?
Thanks

Errors thrown on the server can only make their way to the client using throw new Meteor.Error:

1 Like

Thanks! was helpful indeed!

1 Like