我正在尝试为我们的公共站点创建一个很好的异常消息,因此我通过修改我的Sitecore.Pipelines配置文件来覆盖“Sitecore.Mvc.Pipelines.MvcEvents.Exceptions.ShowAspNetErrorMessage”,如此
namespace Northwestern.Core.Infrastructure.Pipelines
{
public class ExceptionErrorHandler : ExceptionProcessor
{
public override void Process(ExceptionArgs args)
{
var context = args.ExceptionContext;
var httpContext = context.HttpContext;
var exception = context.Exception;
// Return a 500 status code and execute the custom error page.
httpContext.Server.ClearError();
httpContext.Response.StatusCode = 500;
httpContext.Server.Execute("/Error-Page");
}
}
}
这是我的ExceptionErrorHandler代码:
#/usr/bin/env python2.7
import subprocess
# Do something with analytics
# ...
# Now call docxfactory script
subprocess.call(['python3', 'docxcript.py'])
但是,我在上面的代码中放置了一个断点,它永远不会碰到我的断点
答案 0 :(得分:1)
尝试添加如下管道:
<pipelines>
<mvc.exception>
<processor type="Sitecore.Mvc.Pipelines.MvcEvents.Exception.ShowAspNetErrorMessage, Sitecore.Mvc">
<patch:attribute name="type">Northwestern.Core.Infrastructure.Pipelines.ExceptionErrorHandler, Northwestern.Core</patch:attribute>
</processor>
</mvc.exception>
</pipelines>