diff --git a/src/http/partials/Server/HTTP.ServerResponse.cs b/src/http/partials/Server/HTTP.ServerResponse.cs index 71f4273c..76ed0477 100644 --- a/src/http/partials/Server/HTTP.ServerResponse.cs +++ b/src/http/partials/Server/HTTP.ServerResponse.cs @@ -122,8 +122,18 @@ private void WriteAndSend(int statusCode) } catch (Exception e) { - // TODO: Handle it - Console.WriteLine($"{nameof(ServerRequest)} -> {nameof(Send)}: {e}"); + try + { + _response.Close(); + } + catch (Exception exception) + { + Console.WriteLine($"[#1] {nameof(ServerRequest)} -> {nameof(Send)}: {exception}"); + } + finally + { + Console.WriteLine($"[#2] {nameof(ServerRequest)} -> {nameof(Send)}: {e}"); + } } }); }