From 27fe31019104a1d1e728dbcc4f2037ad5e066a02 Mon Sep 17 00:00:00 2001 From: Kaveman <55042475+Kaveinator@users.noreply.github.com> Date: Fri, 16 Aug 2024 00:46:56 -0700 Subject: [PATCH] Update HttpServer.cs Fixed an error where if an exception was hit that was other than an `AggregateException` would result in a generic 404, rather than a 500 with the exception details --- WebServer/HttpServer.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/WebServer/HttpServer.cs b/WebServer/HttpServer.cs index 81f4df2..712a51c 100644 --- a/WebServer/HttpServer.cs +++ b/WebServer/HttpServer.cs @@ -129,9 +129,6 @@ namespace WebServer { response = cache; else if (cache.UpdateMethod != null) response = await cache.UpdateMethod(context, cache); - else { - - } } // Create reponse timeout logic, this will return a string to the client but an exception on the server @@ -186,7 +183,7 @@ namespace WebServer { bool fileExists = File.Exists(fullpath); if (!fileExists) continue; - cache = cache ?? new CachedResponse(this, null); + cache ??= new CachedResponse(this, null); cache.StatusCode = HttpStatusCode.OK; cache.ContentString = await razorEngine.CompileRenderAsync(razorPath, null); cache.ContentType = "text/html"; @@ -212,7 +209,7 @@ namespace WebServer { }; } catch (Exception ex) { - StatusPageModel statusModel = new StatusPageModel(HttpStatusCode.InternalServerError) { + statusPageModel = new StatusPageModel(HttpStatusCode.InternalServerError) { Exception = ex }; }