Hi @stubailo. We've talked today with @aldeed about SimpleSchema and Astronomy. We've discussed how validation work in SS and A and if the mdg:validation-error package fits our needs. We've came to conclusion that it needs one little change. Instead have the details property per error it's better to keep errors structure plain and keep fields like value, message on the same level as type and name. @aldeed is already using such structure and me too in Astronomy 2.0.
I've also added several improvements that I'm using in Astronomy like:
if (ValidationError.is(err)) {
}
for checking if error is an instance of ValidationError. It's much shorter than:
if (err && err.error === ValidationError.ERROR_CODE) {
}
I've also added possibility to change default error message by overriding static property:
Hi @stubailo. We've talked today with @aldeed about SimpleSchema and Astronomy. We've discussed how validation work in SS and A and if the
mdg:validation-error
package fits our needs. We've came to conclusion that it needs one little change. Instead have thedetails
property per error it's better to keep errors structure plain and keep fields likevalue
,message
on the same level astype
andname
. @aldeed is already using such structure and me too in Astronomy 2.0.I've also added several improvements that I'm using in Astronomy like:
for checking if error is an instance of ValidationError. It's much shorter than:
I've also added possibility to change default error message by overriding static property: