Custom errors on admin UI

System Information
  • Strapi Version: 3.3.4
  • Operating System: ubuntu 18.04
  • Database: postgreSQL
  • Node Version: 12.19.0
  • NPM Version: 6.14.8

Hi, in the previous version, I managed to display custom errors on admin UI, by throwing errors with messages I wanted to display.
It seems that this workaround doesn’t work anymore on the current strapi version.

Then I am wondering if there is a way to display custom error messages on admin UI?

Thanks

From backend, you can’t. Only from frontend:

Thanks for the reply :slightly_smiling_face:

Do you have an example to throw custom error message from a model lifecycle?
For example, fields validation in before create?

1 Like

Would love to see something like that as well! Also something like
“Do you really want to do this” - confirm or cancel.

3 Likes

I managed to do that with throw Boom.badRequest(msg); in version 3. Not working anymore on v4 (I installed the boom package because module wasn’t required by strapi anymore)

Here is a v4 solution Throw Error message in lifecycle hook doesnt change the error message display in the UI - #8 by taka