VAR.WebFormsCore: Wrap RouteRequest and Flush inside a try-catch to capture unhandled exceptions
This commit is contained in:
@@ -33,16 +33,25 @@ namespace VAR.WebFormsCore.Code
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
RouteRequest(httpContext);
|
RouteRequest(httpContext);
|
||||||
|
await httpContext.Response.Body.FlushAsync();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (IsIgnoreException(ex) == false)
|
if (IsIgnoreException(ex) == false)
|
||||||
{
|
{
|
||||||
GlobalErrorHandler.HandleError(httpContext, ex);
|
try
|
||||||
|
{
|
||||||
|
// TODO: Implement better error logging
|
||||||
|
Console.WriteLine("!!!!!!!!!!");
|
||||||
|
Console.Write("Message: {0}\nStacktrace: {1}\n", ex.Message, ex.StackTrace);
|
||||||
|
|
||||||
|
GlobalErrorHandler.HandleError(httpContext, ex);
|
||||||
|
await httpContext.Response.Body.FlushAsync();
|
||||||
|
}
|
||||||
|
catch (Exception) { /* Nom nom nom */}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await httpContext.Response.Body.FlushAsync();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool IsIgnoreException(Exception ex)
|
private static bool IsIgnoreException(Exception ex)
|
||||||
|
|||||||
Reference in New Issue
Block a user