feat: 完成错误信息输出
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user