How to display a popup for lifecycle hook errors in Strapi Admin Panel?

Hi,
I want to display a popup notification in the Strapi Admin Panel when a lifecycle hook, such as beforeCreate, throws an error.

Currently, I have the following code in my backend:

module.exports = {
async beforeCreate(event) {
const { data } = event.params;
const forbiddenWords = [“badword1”, “badword2”, “inappropriate”];
if (data.Title) {
const titleLowerCase = data.Title.toLowerCase();
const hasForbiddenWord = forbiddenWords.some((word) =>
titleLowerCase.includes(word.toLowerCase())
);
if (hasForbiddenWord) {
const { ValidationError } = require(‘@strapi/utils’).errors;
throw new ValidationError(“Title contains forbidden words and cannot be saved.”);
}
}
},
};
It’s only display Error Intenal server error
I am using
Strapi v5.5.1
Node v20.15.0
Thank you in advance