From 6d9f564a949e326e909cbcfd37d254195b40ba56 Mon Sep 17 00:00:00 2001 From: David Date: Tue, 2 Jun 2020 15:04:55 +0200 Subject: [PATCH] Remove duplicate code Co-authored-by: Vasily --- Jellyfin.Server/Middleware/ExceptionMiddleware.cs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Jellyfin.Server/Middleware/ExceptionMiddleware.cs b/Jellyfin.Server/Middleware/ExceptionMiddleware.cs index dd4d1ee99b..63effafc19 100644 --- a/Jellyfin.Server/Middleware/ExceptionMiddleware.cs +++ b/Jellyfin.Server/Middleware/ExceptionMiddleware.cs @@ -93,13 +93,9 @@ namespace Jellyfin.Server.Middleware context.Response.ContentType = MediaTypeNames.Text.Plain; // Don't send exception unless the server is in a Development environment - if (!_hostEnvironment.IsDevelopment()) - { - await context.Response.WriteAsync("Error processing request.").ConfigureAwait(false); - return; - } - - var errorContent = NormalizeExceptionMessage(ex.Message); + var errorContent = _hostEnvironment.IsDevelopment() + ? NormalizeExceptionMessage(ex.Message) + : "Error processing request."; await context.Response.WriteAsync(errorContent).ConfigureAwait(false); } }