异常拦截Filter报错问题处理

dev
zhangxiaofeng 4 weeks ago
parent f3b0351eb7
commit 90467c926b

@ -56,13 +56,17 @@ public class GlobalExceptionsFilter : IExceptionFilter
#region 写入日志库
var className = context.Exception.TargetSite.DeclaringType?.FullName;
string? methodName = "";
string? className = context.Exception.TargetSite?.DeclaringType?.FullName ?? "";
if (!string.IsNullOrEmpty(className))
{
var groupCollection = Regex.Match(className, "<(.*?)>").Groups;
var methodName = "";
if (groupCollection.Count > 1)
{
methodName = groupCollection[1].Value;
}
}
var exLog = new SysLogException()
{
ClassName = className,

Loading…
Cancel
Save