aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Startup.cs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/slskd/Startup.cs b/src/slskd/Startup.cs
index ac4a2789..765afa18 100644
--- a/src/slskd/Startup.cs
+++ b/src/slskd/Startup.cs
@@ -25,6 +25,8 @@ namespace slskd
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Builder;
+ using Microsoft.AspNetCore.Diagnostics;
+ using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.ApiExplorer;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
@@ -271,6 +273,11 @@ namespace slskd
// DbContext explicitly.
InitializeDbContexts(app);
+ app.UseExceptionHandler(a => a.Run(async context =>
+ {
+ await context.Response.WriteAsJsonAsync(context.Features.Get<IExceptionHandlerPathFeature>().Error.Message);
+ }));
+
app.UseCors("AllowAll");
if (OptionsAtStartup.Web.Https.Force)