Replace ValidationError by ctx errors in controllers
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
const { createCoreController } = require('@strapi/strapi').factories;
|
||||
const { ValidationError } = require("@strapi/utils").errors
|
||||
const slugify = require('slugify')
|
||||
|
||||
const getSlug = text => {
|
||||
@@ -34,7 +33,7 @@ module.exports = createCoreController('api::artiste.artiste', ({strapi}) => ({
|
||||
}
|
||||
|
||||
if (user.id !== data.user.id || user.username !== data.user.username || user.email !== data.user.email) {
|
||||
throw new ValidationError('Informations non valides.')
|
||||
ctx.badRequest('Informations non valides.')
|
||||
}
|
||||
|
||||
const artiste = await strapi.db.query('api::artiste.artiste').findOne({
|
||||
|
||||
Reference in New Issue
Block a user