System Information
Hello,
in Strapi v4.7.x I could display a custom error message in the Admin UI by throwing an ApplicationError:
throw new utils.errors.ApplicationError(`Custom error message`);
In Strapi v4.8.2 this doesn’t work anymore. The above code results in a generic error message (e.g. “Warning: Request failed with status code 400”).
In the response I can still see the custom error message:
error: {
status: 400
name: "ApplicationError"
message: "Custom error message"
details: { ... }
}
How can I display this custom error message in Strapi v4.8.?
Thank and best regards
Problem is here again. Just upgraded to latest Strapi v4.10.6.
package.json
"@strapi/strapi": "4.10.6",
"@strapi/plugin-users-permissions": "4.10.6",
"@strapi/provider-email-sendgrid": "4.10.6",
"@strapi/provider-upload-cloudinary": "4.10.6"
Code:
throw new utils.errors.ApplicationError("Custom error message");
Network shows:
{
"data":null,
"error":{
"status":400,
"name":"ApplicationError",
"message":"Custom error message",
"details":{}
}
}
But UI shows: “Warning: Request failed with status code 400” 🥲
@Mehoff are you able to fix this error?
I got the solution-
just install the @strapi/utils package and then its working fine
@Abhinegi2
I just tried it with v4.11.1 after installing @strapi/utils package but it is not working for me. In the Admin UI it shows internal server error
.
I’m on v4.13.1 and its still not working. Would be happy if this gets fixed. @DMehaffy any news on that maybe?