Replace ValidationError by ctx errors in controllers

This commit is contained in:
2023-04-02 12:27:05 +04:00
parent d61ef75869
commit bc23730809
2 changed files with 6 additions and 7 deletions
+1 -2
View File
@@ -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({