src/Library/NetPro.Checker/HealthResponse.cs
(完整代码) 1KBusing System;
namespace NetPro.Checker
{
/// <summary>
/// Represents a health check response
/// </summary>
public struct HealthResponse
{
public readonly bool IsHealthy;
public readonly object Response;
private HealthResponse(bool isHealthy, object statusObject)
{
IsHealthy = isHealthy;
Response = statusObject;
}
public static HealthResponse Healthy()
{
return Healthy("OK");
}
public static HealthResponse Healthy(object response)
{
return new HealthResponse(true, response);
}
public static HealthResponse Unhealthy()
{
return Unhealthy("FAILED");
}
public static HealthResponse Unhealthy(object response)
{
return new HealthResponse(false, response);
}
public static HealthResponse Unhealthy(Exception exception)
{
var message = $"EXCEPTION: {exception.GetType().Name}, {exception.Message}";
return new HealthResponse(false, message);
}
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。