File tree 1 file changed +7
-0
lines changed
1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ const convertFilter = require('./utils/convert-filter')
8
8
const createValidationError = require ( './utils/create-validation-error' )
9
9
10
10
const SEQUELIZE_VALIDATION_ERROR = 'SequelizeValidationError'
11
+ const SEQUELIZE_UNIQUE_ERROR = 'SequelizeUniqueConstraintError'
11
12
12
13
class Resource extends BaseResource {
13
14
static isAdapterFor ( rawResource ) {
@@ -134,6 +135,9 @@ class Resource extends BaseResource {
134
135
if ( error . name === SEQUELIZE_VALIDATION_ERROR ) {
135
136
throw createValidationError ( error )
136
137
}
138
+ if ( error . name === SEQUELIZE_UNIQUE_ERROR ) {
139
+ throw createValidationError ( error )
140
+ }
137
141
throw error
138
142
}
139
143
}
@@ -153,6 +157,9 @@ class Resource extends BaseResource {
153
157
if ( error . name === SEQUELIZE_VALIDATION_ERROR ) {
154
158
throw createValidationError ( error )
155
159
}
160
+ if ( error . name === SEQUELIZE_UNIQUE_ERROR ) {
161
+ throw createValidationError ( error )
162
+ }
156
163
throw error
157
164
}
158
165
}
You can’t perform that action at this time.
0 commit comments