diff --git a/src/InterfaceForward.Api/InterfaceForwardApiModule.cs b/src/InterfaceForward.Api/InterfaceForwardApiModule.cs index 97c8a5a..e48d7ac 100644 --- a/src/InterfaceForward.Api/InterfaceForwardApiModule.cs +++ b/src/InterfaceForward.Api/InterfaceForwardApiModule.cs @@ -57,6 +57,8 @@ public class InterfaceForwardApiModule : FakeModule await next.Invoke(); }); + app.UseFakeExceptionHandling(); + // Add Aspire default endpoints. app.MapDefaultEndpoints(); app.MapControllers(); diff --git a/src/InterfaceForward.Application/Filters/ExceptionNotifier.cs b/src/InterfaceForward.Application/Filters/ExceptionNotifier.cs new file mode 100644 index 0000000..8f188af --- /dev/null +++ b/src/InterfaceForward.Application/Filters/ExceptionNotifier.cs @@ -0,0 +1,12 @@ +using Fake.DependencyInjection; +using Fake.ExceptionHandling; + +namespace InterfaceForward.Application.Filters; + +public class ExceptionNotifier: IExceptionNotifier, ITransientDependency +{ + public Task NotifyAsync(ExceptionNotificationContext context) + { + return Task.CompletedTask; + } +} \ No newline at end of file diff --git a/src/InterfaceForward.Application/Services/InterfaceForwardService.cs b/src/InterfaceForward.Application/Services/InterfaceForwardService.cs index 4f957ac..3416db3 100644 --- a/src/InterfaceForward.Application/Services/InterfaceForwardService.cs +++ b/src/InterfaceForward.Application/Services/InterfaceForwardService.cs @@ -17,7 +17,8 @@ namespace InterfaceForward.Application.Services; /// 接口转发服务 /// [ApiExplorerSettings(GroupName = "接口转发服务")] -[TypeFilter(typeof(ForwardAuthorizeFilter))] +[TypeFilter(typeof(ForwardAuthorizeFilter))] +[TypeFilter(typeof(ForwardExceptionFilter))] [AllowAnonymous] [Route("InterfaceForward")] public class InterfaceForwardService : ApplicationService, IInterfaceForwardService