diff --git a/Carbon.ExceptionHandling/Carbon.ExceptionHandling.Abstractions.csproj b/Carbon.ExceptionHandling/Carbon.ExceptionHandling.Abstractions.csproj index 2bd76e1e..bdfb3170 100644 --- a/Carbon.ExceptionHandling/Carbon.ExceptionHandling.Abstractions.csproj +++ b/Carbon.ExceptionHandling/Carbon.ExceptionHandling.Abstractions.csproj @@ -2,8 +2,10 @@ netstandard2.1 - 1.3.0 + 1.3.1 + 1.3.1 + - OverrideExceptionDetail is added 1.3.0 - UnauthorizedOperationException is added 1.2.2 diff --git a/Carbon.ExceptionHandling/CarbonException.cs b/Carbon.ExceptionHandling/CarbonException.cs index 99f186e0..fe6af733 100644 --- a/Carbon.ExceptionHandling/CarbonException.cs +++ b/Carbon.ExceptionHandling/CarbonException.cs @@ -23,6 +23,8 @@ public abstract class CarbonException : Exception /// public object[] Arguments { get; set; } + public bool OverrideExceptionDetail { get; set; } = true; + /// /// CarbonException with only error code 5000. /// diff --git a/Carbon.WebApplication/Carbon.WebApplication.csproj b/Carbon.WebApplication/Carbon.WebApplication.csproj index e353ef70..519a17bb 100644 --- a/Carbon.WebApplication/Carbon.WebApplication.csproj +++ b/Carbon.WebApplication/Carbon.WebApplication.csproj @@ -1,9 +1,10 @@  net6.0;net5.0;netcoreapp3.1 - 4.5.4 + 4.5.6 - 4.5.4 + 4.5.6 + - Added a property named overrideMessageAndCode to the CarbonException class. The default value of this property is set to true. In the constructor of CarbonException, check this property to determine whether the message and code are overridden or not. - Update IPageableDto validator for assign PageSize 0. When PageSize 0 the datas returns without pagination with development in version 4.5.3. 4.5.3 - Upgrade Carbon.PagedList (Remove pageSize and pageNumber validation check) diff --git a/Carbon.WebApplication/HttpGlobalExceptionFilter.cs b/Carbon.WebApplication/HttpGlobalExceptionFilter.cs index 3a721e1b..2f210522 100644 --- a/Carbon.WebApplication/HttpGlobalExceptionFilter.cs +++ b/Carbon.WebApplication/HttpGlobalExceptionFilter.cs @@ -81,7 +81,7 @@ public void OnException(ExceptionContext context) if (context.Exception is CarbonException exception) { - if (!string.IsNullOrEmpty(_errorHandling)) + if (!string.IsNullOrEmpty(_errorHandling) && exception.OverrideExceptionDetail) { var exceptionMessage = GetErrorMessage(exception.ErrorCode, exception.Arguments, context.HttpContext.Request).Result;