In my application, a user must have a unique username and email and While using Sequelize I noticed that Sequelize only throws one unique violation even though both of the fields have a duplicate username and email.

But the problem with the unique violation thrown is that both emailOrPhone and username have violated the unique violation but the error only shows one.
My User Model:
User.init(
{
id: {
type: DataTypes.UUID,
unique: true,
validate: {
notEmpty: true,
},
primaryKey: true,
defaultValue: DataTypes.UUIDV4,
},
emailOrPhone: {
type: DataTypes.STRING,
unique: {
args: true,
msg: 'Email address or phone number is already in use',
},
validate: {
notEmpty: {
args: true,
msg: 'Email or phone is required',
},
},
},
userName: {
type: DataTypes.STRING,
unique: {
args: true,
msg: 'Username is already taken',
},
validate: {
notEmpty: {
args: true,
msg: 'Username is required',
},
},
},
fullName: {
type: DataTypes.STRING,
validate: {
notEmpty: {
args: true,
msg: 'Name is required',
},
},
},
password: {
type: DataTypes.STRING,
validate: {
notEmpty: {
args: true,
msg: 'Password Field is required',
},
},
},
profilePicture: {
type: DataTypes.STRING,
notEmpty: true,
defaultValue: path.resolve('profile.jpg'),
},
roles: {
type: DataTypes.JSON,
defaultValue: ['user'],
validate: {
notEmpty: true,
},
},
createdAt: {
type: DataTypes.DATE,
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP'),
validate: {
notEmpty: true,
},
},
updatedAt: {
type: DataTypes.DATE,
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP'),
validate: {
notEmpty: true,
},
},
},
{
sequelize: Sequelize,
modelName: 'User',
}
);
So my question is that is there any way to show both the unique violation error fields.
