-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Closed
Labels
staletype: bugDEPRECATED: replace with the "bug" issue typeDEPRECATED: replace with the "bug" issue type
Description
What you are doing?
Creating a record with the same value in a column that is Unique:true. I'm using FeathersJS with uses Sequelize. I successfully inserted new record via restful api using Postman. However if I send the same request again( create a user with the same email which the column is unique) it crashes the server with error "TypeError: Cannot read property '2' of null".
Below is the model I am using
// code here
const Sequelize = require('sequelize');
module.exports = function(sequelize) {
const user = sequelize.define('users', {
email: {
type: Sequelize.STRING,
allowNull: false,
unique: true
},
password: {
type: Sequelize.STRING,
allowNull: false
}
}, {
freezeTableName: true
});What do you expect to happen?
I expected to get a response back with an error stating its a duplicate or at least a clean error.
What is actually happening?
Crashed server since error wasn't caught.
Output, either JSON or SQL
Dialect: mysql
Database version: 5.7.13
Sequelize version: 3.24.4
Metadata
Metadata
Assignees
Labels
staletype: bugDEPRECATED: replace with the "bug" issue typeDEPRECATED: replace with the "bug" issue type
