add(filter): 新增全局错误拦截器
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
|
||||
using IM_API.Configs;
|
||||
using IM_API.Filters;
|
||||
using IM_API.Hubs;
|
||||
using IM_API.Models;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
@@ -97,7 +98,10 @@ namespace IM_API
|
||||
}
|
||||
};
|
||||
});
|
||||
builder.Services.AddControllers();
|
||||
builder.Services.AddControllers(options =>
|
||||
{
|
||||
options.Filters.Add<GlobalExceptionFilter>();
|
||||
});
|
||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen();
|
||||
|
||||
Reference in New Issue
Block a user