-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to override exception message to respone from ABP farmework #16893
Comments
Just override the relevant localization strings. For example, for internal server error message, you need to override |
I tried with below code and the exception is not going through this class. My requirement not to just change localization string , need to change few things here
|
It worked when i made below changes [Dependency(ReplaceServices = true)] to public class CustomExceptionToErrorInfoConverter : : IExceptionToErrorInfoConverter, ITransientDependency Please explain why is it so, this should work with Dependency and ExposeServices Attributes right and this is working with out those? |
Glad it worked after recent changes 🥳 In response to your question, the code that shows how to override an example method like the one below should work. [Dependency(ReplaceServices = true)]
[ExposeServices(typeof(DefaultExceptionToErrorInfoConverter), typeof(IExceptionToErrorInfoConverter))]
public class CustomExceptionToErrorInfoConverter : DefaultExceptionToErrorInfoConverter
{
protected override RemoteServiceErrorInfo CreateErrorInfoWithoutCode(Exception exception, AbpExceptionHandlingOptions options)
{
// code
}
} Closing the issue. Feel free to re-open or create a new issue if you have further questions. |
How to override exception message to respone through ABP farmework commonly
Have tried the things which is in below link but it was only to read. Please help here.
https://docs.abp.io/en/abp/latest/Exception-Handling#subscribing-to-the-exceptions
The text was updated successfully, but these errors were encountered: