fix(server): fixes status path returns database path and error message to clients
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user