Browse Source

Set `SendExceptionDataToClientTypes` from options.

pull/20812/head
maliming 2 years ago
parent
commit
bdbe95bc79
No known key found for this signature in database GPG Key ID: A646B9CB645ECEA4
  1. 1
      framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/ExceptionHandling/UserExceptionInformer.cs
  2. 1
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Controllers/ErrorController.cs
  3. 1
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/AbpExceptionFilter.cs
  4. 1
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/AbpExceptionPageFilter.cs
  5. 1
      framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/AbpExceptionHandlingMiddleware.cs
  6. 16
      framework/src/Volo.Abp.ExceptionHandling/Volo/Abp/AspNetCore/ExceptionHandling/AbpExceptionHandlingOptions.cs
  7. 6
      framework/src/Volo.Abp.ExceptionHandling/Volo/Abp/AspNetCore/ExceptionHandling/DefaultExceptionToErrorInfoConverter.cs
  8. 1
      modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AuditLogInfoToAuditLogConverter.cs

1
framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/ExceptionHandling/UserExceptionInformer.cs

@ -67,6 +67,7 @@ public class UserExceptionInformer : IUserExceptionInformer, IScopedDependency
{ {
options.SendExceptionsDetailsToClients = Options.SendExceptionsDetailsToClients; options.SendExceptionsDetailsToClients = Options.SendExceptionsDetailsToClients;
options.SendStackTraceToClients = Options.SendStackTraceToClients; options.SendStackTraceToClients = Options.SendStackTraceToClients;
options.SendExceptionDataToClientTypes = Options.SendExceptionDataToClientTypes;
}); });
} }
} }

1
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Controllers/ErrorController.cs

@ -51,6 +51,7 @@ public class ErrorController : AbpController
{ {
options.SendExceptionsDetailsToClients = ExceptionHandlingOptions.SendExceptionsDetailsToClients; options.SendExceptionsDetailsToClients = ExceptionHandlingOptions.SendExceptionsDetailsToClients;
options.SendStackTraceToClients = ExceptionHandlingOptions.SendStackTraceToClients; options.SendStackTraceToClients = ExceptionHandlingOptions.SendStackTraceToClients;
options.SendExceptionDataToClientTypes = ExceptionHandlingOptions.SendExceptionDataToClientTypes;
}); });
if (httpStatusCode == 0) if (httpStatusCode == 0)

1
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/AbpExceptionFilter.cs

@ -102,6 +102,7 @@ public class AbpExceptionFilter : IAsyncExceptionFilter, IAbpFilter, ITransientD
{ {
options.SendExceptionsDetailsToClients = exceptionHandlingOptions.SendExceptionsDetailsToClients; options.SendExceptionsDetailsToClients = exceptionHandlingOptions.SendExceptionsDetailsToClients;
options.SendStackTraceToClients = exceptionHandlingOptions.SendStackTraceToClients; options.SendStackTraceToClients = exceptionHandlingOptions.SendStackTraceToClients;
options.SendExceptionDataToClientTypes = exceptionHandlingOptions.SendExceptionDataToClientTypes;
}); });
var remoteServiceErrorInfoBuilder = new StringBuilder(); var remoteServiceErrorInfoBuilder = new StringBuilder();

1
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/AbpExceptionPageFilter.cs

@ -81,6 +81,7 @@ public class AbpExceptionPageFilter : IAsyncPageFilter, IAbpFilter, ITransientDe
{ {
options.SendExceptionsDetailsToClients = exceptionHandlingOptions.SendExceptionsDetailsToClients; options.SendExceptionsDetailsToClients = exceptionHandlingOptions.SendExceptionsDetailsToClients;
options.SendStackTraceToClients = exceptionHandlingOptions.SendStackTraceToClients; options.SendStackTraceToClients = exceptionHandlingOptions.SendStackTraceToClients;
options.SendExceptionDataToClientTypes = exceptionHandlingOptions.SendExceptionDataToClientTypes;
}); });
var logLevel = context.Exception!.GetLogLevel(); var logLevel = context.Exception!.GetLogLevel();

1
framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/AbpExceptionHandlingMiddleware.cs

@ -92,6 +92,7 @@ public class AbpExceptionHandlingMiddleware : AbpMiddlewareBase, ITransientDepen
{ {
options.SendExceptionsDetailsToClients = exceptionHandlingOptions.SendExceptionsDetailsToClients; options.SendExceptionsDetailsToClients = exceptionHandlingOptions.SendExceptionsDetailsToClients;
options.SendStackTraceToClients = exceptionHandlingOptions.SendStackTraceToClients; options.SendStackTraceToClients = exceptionHandlingOptions.SendStackTraceToClients;
options.SendExceptionDataToClientTypes = exceptionHandlingOptions.SendExceptionDataToClientTypes;
}) })
) )
) )

16
framework/src/Volo.Abp.ExceptionHandling/Volo/Abp/AspNetCore/ExceptionHandling/AbpExceptionHandlingOptions.cs

@ -5,9 +5,19 @@ namespace Volo.Abp.AspNetCore.ExceptionHandling;
public class AbpExceptionHandlingOptions 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)
];
}
} }

6
framework/src/Volo.Abp.ExceptionHandling/Volo/Abp/AspNetCore/ExceptionHandling/DefaultExceptionToErrorInfoConverter.cs

@ -329,11 +329,7 @@ public class DefaultExceptionToErrorInfoConverter : IExceptionToErrorInfoConvert
return new AbpExceptionHandlingOptions return new AbpExceptionHandlingOptions
{ {
SendExceptionsDetailsToClients = false, SendExceptionsDetailsToClients = false,
SendStackTraceToClients = true, SendStackTraceToClients = true
SendExceptionDataToClientTypes =
{
typeof(IBusinessException)
}
}; };
} }
} }

1
modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AuditLogInfoToAuditLogConverter.cs

@ -57,6 +57,7 @@ public class AuditLogInfoToAuditLogConverter : IAuditLogInfoToAuditLogConverter,
{ {
options.SendExceptionsDetailsToClients = ExceptionHandlingOptions.SendExceptionsDetailsToClients; options.SendExceptionsDetailsToClients = ExceptionHandlingOptions.SendExceptionsDetailsToClients;
options.SendStackTraceToClients = ExceptionHandlingOptions.SendStackTraceToClients; options.SendStackTraceToClients = ExceptionHandlingOptions.SendStackTraceToClients;
options.SendExceptionDataToClientTypes = ExceptionHandlingOptions.SendExceptionDataToClientTypes;
})) }))
?? new List<RemoteServiceErrorInfo>(); ?? new List<RemoteServiceErrorInfo>();

Loading…
Cancel
Save