feat:添加异常过滤器
This commit is contained in:
parent
17aa5a8b7f
commit
ec0acc2421
@ -57,6 +57,8 @@ public class InterfaceForwardApiModule : FakeModule
|
||||
await next.Invoke();
|
||||
});
|
||||
|
||||
app.UseFakeExceptionHandling();
|
||||
|
||||
// Add Aspire default endpoints.
|
||||
app.MapDefaultEndpoints();
|
||||
app.MapControllers();
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
@ -18,6 +18,7 @@ namespace InterfaceForward.Application.Services;
|
||||
/// </summary>
|
||||
[ApiExplorerSettings(GroupName = "接口转发服务")]
|
||||
[TypeFilter(typeof(ForwardAuthorizeFilter))]
|
||||
[TypeFilter(typeof(ForwardExceptionFilter))]
|
||||
[AllowAnonymous]
|
||||
[Route("InterfaceForward")]
|
||||
public class InterfaceForwardService : ApplicationService, IInterfaceForwardService
|
||||
|
||||
Loading…
Reference in New Issue
Block a user