-
Template: microservice
-
Created ABP Studio Version: 0.9.5
-
Current ABP Studio Version: 0.9.21
-
UI Framework: angular
-
Theme: leptonx
-
Theme Style: system
-
Database Provider: ef
-
Database Management System: sqlserver
-
Mobile Framework: maui
-
Public Website: Yes
We are currently working on customizing the error messages returned by our ABP-based application in cases where exceptions occur. We have successfully implemented custom error messages for BusinessException as described in the ABP documentation. (https://abp.io/docs/latest/framework/fundamentals/exception-handling)
However, we are encountering difficulties in modifying the error messages for other types of exceptions (e.g., ArgumentException, InvalidOperationException, or generic Exception) . Our goal is to provide custom error messages to the client, with multilanguage support, instead of exposing the default exception details.
Specifically, we would like to know what is the recommended approach for intercepting and modifying exception messages before they are returned to the client in non-business exception scenarios?
1 Answer(s)
-
0
Hi,
You can replace the
DefaultExceptionToErrorInfoConverter
with yours.[ExposeServicest(typeof(IExceptionToErrorInfoConverter))] public class MyExceptionToErrorInfoCoverter : IExceptionToErrorInfoConverter, ITransientDependency { .... }
See more: https://abp.io/support/questions/5214/Replace-ABPException-with-my-CustomException