mirror of
https://github.com/DrMboga/WotBlitzStatisticsBlazor.git
synced 2026-10-24 20:00:05 +02:00
feature: Server error provider added, client notification service added
This commit is contained in:
1 parent
3c67595d94
commit
b928e0fec9
14 files changed
+200
-11
No files matched your search
@@ -0,0 +1,22 @@
|
||||
using HotChocolate;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace WotBlitzStatisticsPro.GraphQl
|
||||
{
|
||||
public class GraphQlErrorFilter: IErrorFilter
|
||||
{
|
||||
private readonly ILogger<GraphQlErrorFilter> _logger;
|
||||
|
||||
public GraphQlErrorFilter(ILogger<GraphQlErrorFilter> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public IError OnError(IError error)
|
||||
{
|
||||
_logger.LogError(error.Exception, $"Operation {error.Path}");
|
||||
|
||||
return error;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Security.Claims;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HotChocolate;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
@@ -11,6 +12,7 @@ using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Diagnostics.HealthChecks;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using WotBlitzStatisticsPro.Common;
|
||||
using WotBlitzStatisticsPro.Common.Model;
|
||||
@@ -77,7 +79,6 @@ namespace WotBlitzStatisticsPro.GraphQl
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
// Add GraphQL Services
|
||||
services.AddGraphQLServer()
|
||||
.AddQueryType(d => d.Name("Query"))
|
||||
@@ -107,6 +108,10 @@ namespace WotBlitzStatisticsPro.GraphQl
|
||||
|
||||
return ValueTask.CompletedTask;
|
||||
})
|
||||
.ModifyRequestOptions(opt => opt.IncludeExceptionDetails = true)
|
||||
.AddErrorFilter(sp =>
|
||||
new GraphQlErrorFilter
|
||||
(sp.GetApplicationService<ILogger<GraphQlErrorFilter>>()))
|
||||
;
|
||||
|
||||
// Blazor
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.4" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="5.0.4" />
|
||||
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="6.10.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.10.0" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
Reference in new issue
Block a user