SoftwareBrothers / adminjs-sequelizejs

Sequelizejs adapter for AdminBro
MIT License
27 stars 34 forks source link

Validation error unique #41

Closed leibowitz closed 4 years ago

leibowitz commented 4 years ago

Fix #17

Handle all ValidationError from sequelize and pass them back

This handles UniqueConstraintError as well, since it extends on ValidationError

wojtek-krysiak commented 4 years ago

can you change checking of the type (instanceof) to checking by the error.name?

instanceof doesn't work well when you have related packages where one depends on the other. It is super hard to explain but I will try :).

Let say you are working on let say my-admin-bro package and this package depends on sequelize and also it depends on admin-bro-sequlelize which depends on sequelize sometimes (especially in dev environment). In that case Sequelize required from admin-bro is not the same as sequelize from admin-bro-sequelize (npm installs different versions of the same library) that is why instanceof won't work. In order to fix that we require sequelize as a peerDependency in admin-bro-sequelize but it is only in production. In dev and test environments we have it set as a regular dependency

github-actions[bot] commented 4 years ago

:tada: This PR is included in version 1.0.0-beta.3 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

wojtek-krysiak commented 4 years ago

thanks!!!

github-actions[bot] commented 4 years ago

:tada: This PR is included in version 1.0.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: