Browse Source
Set `SendExceptionDataToClientTypes` from options.
pull/20812/head
maliming
2 years ago
No known key found for this signature in database
GPG Key ID: A646B9CB645ECEA4
8 changed files with
20 additions and
8 deletions
-
framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/ExceptionHandling/UserExceptionInformer.cs
-
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Controllers/ErrorController.cs
-
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/AbpExceptionFilter.cs
-
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/AbpExceptionPageFilter.cs
-
framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/AbpExceptionHandlingMiddleware.cs
-
framework/src/Volo.Abp.ExceptionHandling/Volo/Abp/AspNetCore/ExceptionHandling/AbpExceptionHandlingOptions.cs
-
framework/src/Volo.Abp.ExceptionHandling/Volo/Abp/AspNetCore/ExceptionHandling/DefaultExceptionToErrorInfoConverter.cs
-
modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AuditLogInfoToAuditLogConverter.cs
|
|
|
@ -67,6 +67,7 @@ public class UserExceptionInformer : IUserExceptionInformer, IScopedDependency |
|
|
|
{ |
|
|
|
options.SendExceptionsDetailsToClients = Options.SendExceptionsDetailsToClients; |
|
|
|
options.SendStackTraceToClients = Options.SendStackTraceToClients; |
|
|
|
options.SendExceptionDataToClientTypes = Options.SendExceptionDataToClientTypes; |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -51,6 +51,7 @@ public class ErrorController : AbpController |
|
|
|
{ |
|
|
|
options.SendExceptionsDetailsToClients = ExceptionHandlingOptions.SendExceptionsDetailsToClients; |
|
|
|
options.SendStackTraceToClients = ExceptionHandlingOptions.SendStackTraceToClients; |
|
|
|
options.SendExceptionDataToClientTypes = ExceptionHandlingOptions.SendExceptionDataToClientTypes; |
|
|
|
}); |
|
|
|
|
|
|
|
if (httpStatusCode == 0) |
|
|
|
|
|
|
|
@ -102,6 +102,7 @@ public class AbpExceptionFilter : IAsyncExceptionFilter, IAbpFilter, ITransientD |
|
|
|
{ |
|
|
|
options.SendExceptionsDetailsToClients = exceptionHandlingOptions.SendExceptionsDetailsToClients; |
|
|
|
options.SendStackTraceToClients = exceptionHandlingOptions.SendStackTraceToClients; |
|
|
|
options.SendExceptionDataToClientTypes = exceptionHandlingOptions.SendExceptionDataToClientTypes; |
|
|
|
}); |
|
|
|
|
|
|
|
var remoteServiceErrorInfoBuilder = new StringBuilder(); |
|
|
|
|
|
|
|
@ -81,6 +81,7 @@ public class AbpExceptionPageFilter : IAsyncPageFilter, IAbpFilter, ITransientDe |
|
|
|
{ |
|
|
|
options.SendExceptionsDetailsToClients = exceptionHandlingOptions.SendExceptionsDetailsToClients; |
|
|
|
options.SendStackTraceToClients = exceptionHandlingOptions.SendStackTraceToClients; |
|
|
|
options.SendExceptionDataToClientTypes = exceptionHandlingOptions.SendExceptionDataToClientTypes; |
|
|
|
}); |
|
|
|
|
|
|
|
var logLevel = context.Exception!.GetLogLevel(); |
|
|
|
|
|
|
|
@ -92,6 +92,7 @@ public class AbpExceptionHandlingMiddleware : AbpMiddlewareBase, ITransientDepen |
|
|
|
{ |
|
|
|
options.SendExceptionsDetailsToClients = exceptionHandlingOptions.SendExceptionsDetailsToClients; |
|
|
|
options.SendStackTraceToClients = exceptionHandlingOptions.SendStackTraceToClients; |
|
|
|
options.SendExceptionDataToClientTypes = exceptionHandlingOptions.SendExceptionDataToClientTypes; |
|
|
|
}) |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
@ -5,9 +5,19 @@ namespace Volo.Abp.AspNetCore.ExceptionHandling; |
|
|
|
|
|
|
|
public class AbpExceptionHandlingOptions |
|
|
|
{ |
|
|
|
public bool SendExceptionsDetailsToClients { get; set; } = false; |
|
|
|
public bool SendExceptionsDetailsToClients { get; set; } |
|
|
|
|
|
|
|
public bool SendStackTraceToClients { get; set; } = true; |
|
|
|
public bool SendStackTraceToClients { get; set; } |
|
|
|
|
|
|
|
public List<Type> SendExceptionDataToClientTypes { get; } = new List<Type>(); |
|
|
|
public List<Type> SendExceptionDataToClientTypes { get; set; } |
|
|
|
|
|
|
|
public AbpExceptionHandlingOptions() |
|
|
|
{ |
|
|
|
SendExceptionsDetailsToClients = false; |
|
|
|
SendStackTraceToClients = true; |
|
|
|
SendExceptionDataToClientTypes = |
|
|
|
[ |
|
|
|
typeof(IBusinessException) |
|
|
|
]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -329,11 +329,7 @@ public class DefaultExceptionToErrorInfoConverter : IExceptionToErrorInfoConvert |
|
|
|
return new AbpExceptionHandlingOptions |
|
|
|
{ |
|
|
|
SendExceptionsDetailsToClients = false, |
|
|
|
SendStackTraceToClients = true, |
|
|
|
SendExceptionDataToClientTypes = |
|
|
|
{ |
|
|
|
typeof(IBusinessException) |
|
|
|
} |
|
|
|
SendStackTraceToClients = true |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -57,6 +57,7 @@ public class AuditLogInfoToAuditLogConverter : IAuditLogInfoToAuditLogConverter, |
|
|
|
{ |
|
|
|
options.SendExceptionsDetailsToClients = ExceptionHandlingOptions.SendExceptionsDetailsToClients; |
|
|
|
options.SendStackTraceToClients = ExceptionHandlingOptions.SendStackTraceToClients; |
|
|
|
options.SendExceptionDataToClientTypes = ExceptionHandlingOptions.SendExceptionDataToClientTypes; |
|
|
|
})) |
|
|
|
?? new List<RemoteServiceErrorInfo>(); |
|
|
|
|
|
|
|
|