【发布时间】:2021-04-08 10:05:47
【问题描述】:
我需要从过滤器发送一些状态代码,但我不知道如何传递适当的上下文异常。我看到了HttpActionExecutedContext,但不知道它在哪里,在什么命名空间中......顺便说一句,它的.net core 5,web api
public class AuthFilter : ExceptionFilterAttribute
{
public override void OnException(ExceptionContext context)
{
if (context.Exception is CustomerDataException)
{
}
else if (context.Exception is CustomerNotFoundException)
{
}
else if (context.Exception is CustomerExistsException)
{
}
}
}
【问题讨论】:
标签: .net asp.net-core webapi