Skip to content

Unhandled rejection SequelizeValidationError not work with catch even if validator specified #4304

@anjmao

Description

@anjmao

I Have table with fields:
name:string;
idUser:integer;

on my model validator I added
...
idUser: {
type: sequelize.INTEGER,
validate: {
isInt: true,
equals: 7
}
}
...
now if I post data with idUser = 100, I can catch this error with catch function(equals error works and I can send it to UI), but if I pass idUser = "someNotInteger" I get error Unhandled rejection SequelizeValidationError: "someNotIntege" is not a valid integer, but I can't catch it, only see this error in console. From stack trace I see equals validator use tryCatcher, but isInt validator use INTEGER.validate from data-types.js. This is really bad, because nodejs app will be terminated in such situations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions