mirror of
https://github.com/AssetRipper/AssetRipper.git
synced 2025-12-11 20:15:29 +01:00
22 lines
437 B
C#
22 lines
437 B
C#
using AssetRipper.Import.Logging;
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
namespace AssetRipper.GUI.Web;
|
|
|
|
internal sealed class ErrorHandlingMiddleware : IMiddleware
|
|
{
|
|
public async Task InvokeAsync(HttpContext context, RequestDelegate next)
|
|
{
|
|
try
|
|
{
|
|
await next(context);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Logger.Error(ex);
|
|
|
|
context.Response.Redirect("/"); // Redirect to the main page since we don't have an error page.
|
|
}
|
|
}
|
|
}
|