fix(server): fixes status path returns database path and error message to clients

This commit is contained in:
2026-07-18 18:08:00 +02:00
parent ff78aaa6b4
commit 02e4462520
2 changed files with 10 additions and 7 deletions
+2 -6
View File
@@ -198,15 +198,11 @@ app.MapGet(settings.StatusPath, (HttpContext context, TunnelHub hub, ServerSetti
embeddingCache = new
{
available = embeddingCache.IsAvailable,
count = embeddingCache.Count,
databasePath = embeddingCache.DatabasePath,
lastError = embeddingCache.LastError
count = embeddingCache.Count
},
management = new
{
available = managementStore.IsAvailable,
databasePath = managementStore.DatabasePath,
lastError = managementStore.LastError
available = managementStore.IsAvailable
},
clients = hub.ClientsSnapshot
});
@@ -1,4 +1,5 @@
using System.Text.Json;
using ElmahCore;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.Extensions.Primitives;
using ReverseLlama.Protocol;
@@ -569,10 +570,16 @@ internal static class ReverseProxyEndpoint
{
logger.LogWarning(exception, "Proxy request {RequestId} failed.", requestId);
var errorLog = context.RequestServices.GetService<ErrorLog>();
if (errorLog is not null)
{
await errorLog.LogAsync(new Error(exception, context));
}
if (!context.Response.HasStarted)
{
context.Response.StatusCode = StatusCodes.Status502BadGateway;
await context.Response.WriteAsync(exception.Message, CancellationToken.None);
await context.Response.WriteAsync("Bad gateway", CancellationToken.None);
}
else
{