Sequelize validation errors are not properly getting handled.
I am using Admin Bro with Express and Sequelize.
"admin-bro": "2.2.5",
"admin-bro-expressjs": "2.0.4",
"admin-bro-sequelizejs": "0.4.0",
"sequelize": "5.21.7",
Admin Bro only handles isRequired validation gracefully for non foreign key attributes of a Model. Other validations return internet server error. Following are the validations which are not handled in my use case.
- Unique Column Validation
- If an attribute is a foreign key.

In the above screenshot, mobile number should be unique, but it does not gracefully handle it and 500 is returned.
please write you schema definition for this particular field
In model its
mobile: {
type: DataTypes.STRING,
allowNull: false,
unique: true
}
In one migration, i added the column
queryInterface.addColumn('users', 'mobile',{
type: Sequelize.STRING,
allowNull: false,
})
and in a later migration i added the unique contraint as well.
queryInterface.addConstraint('users', ['mobile'], {
type: 'unique',
name: 'users_mobile_unique_constraint'
})
Not sure if this is related https://github.com/SoftwareBrothers/admin-bro-sequelizejs/issues/17
fixed with @admin-bro/[email protected]