feat: 完成错误信息输出

This commit is contained in:
ccnetcore
2025-07-02 00:28:44 +08:00
parent 1200d02fbf
commit 44b2ade9bc
2 changed files with 60 additions and 10 deletions

View File

@@ -0,0 +1,31 @@
using Microsoft.Extensions.Logging;
namespace Yi.Framework.AiHub.Domain.AiChat;
public class ChatErrorException : Exception
{
public string? Code { get; set; }
public string? Details { get; set; }
public LogLevel LogLevel { get; set; }
public ChatErrorException(
string? code = null,
string? message = null,
string? details = null,
Exception? innerException = null,
LogLevel logLevel = LogLevel.Warning)
: base(message, innerException)
{
this.Code = code;
this.Details = details;
this.LogLevel = logLevel;
}
public ChatErrorException WithData(string name, object value)
{
this.Data[(object)name] = value;
return this;
}
}