diff options
Diffstat (limited to 'Program.cs')
| -rw-r--r-- | Program.cs | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -1,8 +1,9 @@ -using Microsoft.EntityFrameworkCore; -using System.Text.Json.Serialization; using HyperBooru.Services; using Microsoft.AspNetCore.Authentication.Cookies; using Microsoft.AspNetCore.DataProtection; +using Microsoft.AspNetCore.Http.Json; +using Microsoft.EntityFrameworkCore; +using System.Text.Json.Serialization; namespace HyperBooru; @@ -17,6 +18,9 @@ public class Program { var converter = new JsonStringEnumConverter(); o.JsonSerializerOptions.Converters.Add(converter); }); + builder.Services.Configure<JsonOptions>(o => { + o.SerializerOptions.TypeInfoResolverChain.Insert(0, new ExceptionJsonResolver()); + }); builder.Services.AddRazorPages(); builder.Services.AddServerSideBlazor(); @@ -49,6 +53,7 @@ public class Program { app.UseHsts(); app.UseHttpsRedirection(); app.UseStaticFiles(); + app.UseMiddleware<ExceptionMiddleware>(); app.UseRouting(); app.MapBlazorHub(); app.MapControllers(); |
