Throw Error message in lifecycle hook doesnt change the error message display in the UI

I did it in this way:

module.exports = {
      lifecycles: {
        beforeCreate(data) {
        	if (someCondition(data)) {
        		// throw error here, it will prevent the entry creation
        		throw strapi.errors.badRequest('Some message you want to show in the admin UI');
        	}
        },
      },
    };
2 Likes