Replace ValidationError by ApplicationError in services & lifecycles
This commit is contained in:
@@ -4,7 +4,7 @@ const axios = require('axios')
|
||||
const Diff = require('diff')
|
||||
|
||||
const { createCoreService } = require('@strapi/strapi').factories;
|
||||
const { ValidationError } = require("@strapi/utils").errors
|
||||
const { ApplicationError } = require("@strapi/utils").errors
|
||||
|
||||
class Translator {
|
||||
constructor() {
|
||||
@@ -56,15 +56,15 @@ module.exports = createCoreService('api::parole.parole', ({strapi}) => ({
|
||||
},
|
||||
validateParoles(titre, transcription) {
|
||||
if (!titre || titre.trim().length === 0) {
|
||||
throw new ValidationError('Champ obligatoire. Veuillez choisir un titre.');
|
||||
throw new ApplicationError('Champ obligatoire. Veuillez choisir un titre.');
|
||||
}
|
||||
|
||||
if (!transcription || transcription.trim().length === 0) {
|
||||
throw new ValidationError('Champ obligatoire. Veuillez renseigner la transcription.')
|
||||
throw new ApplicationError('Champ obligatoire. Veuillez renseigner la transcription.')
|
||||
}
|
||||
|
||||
if (transcription.trim().length < 10) {
|
||||
throw new ValidationError('La transcription doit contenir au moins 10 caractères.')
|
||||
throw new ApplicationError('La transcription doit contenir au moins 10 caractères.')
|
||||
}
|
||||
},
|
||||
parolesDiff(titre = '', oldString, newString) {
|
||||
|
||||
Reference in New Issue
Block a user