Fixed api exception handler
This commit is contained in:
@@ -24,7 +24,7 @@
|
|||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="MoonCore" Version="1.7.8" />
|
<PackageReference Include="MoonCore" Version="1.7.8" />
|
||||||
<PackageReference Include="MoonCore.Extended" Version="1.2.1" />
|
<PackageReference Include="MoonCore.Extended" Version="1.2.2" />
|
||||||
<PackageReference Include="MoonCore.PluginFramework" Version="1.0.5" />
|
<PackageReference Include="MoonCore.PluginFramework" Version="1.0.5" />
|
||||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.2" />
|
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.2" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0"/>
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0"/>
|
||||||
|
|||||||
@@ -129,6 +129,7 @@ public class Startup
|
|||||||
{
|
{
|
||||||
WebApplicationBuilder.Services.AutoAddServices<Startup>();
|
WebApplicationBuilder.Services.AutoAddServices<Startup>();
|
||||||
WebApplicationBuilder.Services.AddHttpClient();
|
WebApplicationBuilder.Services.AddHttpClient();
|
||||||
|
|
||||||
WebApplicationBuilder.Services.AddApiExceptionHandler();
|
WebApplicationBuilder.Services.AddApiExceptionHandler();
|
||||||
|
|
||||||
// Add pre-existing services
|
// Add pre-existing services
|
||||||
@@ -151,7 +152,7 @@ public class Startup
|
|||||||
private Task UseBase()
|
private Task UseBase()
|
||||||
{
|
{
|
||||||
WebApplication.UseRouting();
|
WebApplication.UseRouting();
|
||||||
WebApplication.UseExceptionHandler("/");
|
WebApplication.UseApiExceptionHandler();
|
||||||
|
|
||||||
if (Configuration.Client.Enable)
|
if (Configuration.Client.Enable)
|
||||||
{
|
{
|
||||||
@@ -447,6 +448,11 @@ public class Startup
|
|||||||
"Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware",
|
"Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware",
|
||||||
LogLevel.Critical
|
LogLevel.Critical
|
||||||
);
|
);
|
||||||
|
|
||||||
|
WebApplicationBuilder.Logging.AddFilter(
|
||||||
|
"Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware",
|
||||||
|
LogLevel.Critical
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
Reference in New Issue
Block a user