Replace ValidationError by ApplicationError in services & lifecycles
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
const { createCoreController } = require('@strapi/strapi').factories;
|
||||
const { ValidationError, NotFoundError, UnauthorizedError } = require("@strapi/utils").errors
|
||||
const { ApplicationError, NotFoundError, UnauthorizedError } = require("@strapi/utils").errors
|
||||
|
||||
module.exports = createCoreController('api::commentaire.commentaire', ({strapi}) => ({
|
||||
async create(ctx) {
|
||||
@@ -28,7 +28,7 @@ module.exports = createCoreController('api::commentaire.commentaire', ({strapi})
|
||||
}
|
||||
|
||||
if (user.id !== data.user.id || user.username !== data.user.username || user.email !== data.user.email) {
|
||||
throw new ValidationError('Informations non valides.')
|
||||
throw new ApplicationError('Informations non valides.')
|
||||
}
|
||||
|
||||
data.user = user.id
|
||||
|
||||
Reference in New Issue
Block a user