Cannot display custom error message on UI

Hello, I am trying to extend media(upload) plugin . I have a requirement to restrict the types of files we can upload. So we extended the media upload controller method.

My problem is I want to return 400 bad request with custom error message. and want the message to be displayed on UI.

but on UI it is displayed as ‘Request failed with 400 bad request’ but not the error message.I can see the network tab i can see the response coming back with the custom error message.
I tried ctx.badRequest() and also throw ApplicationError() but none of them worked. I can’t see the error message on UI
Strapi version : 4.1.2

details=“System Information”]

  • Strapi Version:
  • Operating System:
  • Database:
  • Node Version:
  • NPM Version:
  • Yarn Version:

Just to let you all know. I have a raised a issue in github and they are fixing this issue


Can you help me to override the plugin? I am trying to create file at the given location it is not working