我继承了一个项目,以前的开发人员将其添加到应用程序控制器:
rescue_from Exception, :with => :render_500
Run Code Online (Sandbox Code Playgroud)
我认为是抓住这个并呈现动态页面.静态页面是不可接受的,但我现在不确定为什么会这样.在任何情况下,这都会破坏我使用Exceptional捕获异常的能力.在呈现动态错误页面后,有没有办法重新引发异常?
我试过这个:
def rescue_from(exception)
respond_to |format|
format.html { #render the page# }
end
raise exception
end
Run Code Online (Sandbox Code Playgroud)
但是,很明显,这不起作用.有任何想法吗?
您可以手动发布到例外 - 而不是尝试重新加注并获得Exceptional来捕获和发布.
def rescue_from(exception)
::Exceptional::Catcher.handle(exception)
respond_to |format|
format.html { #render the page# }
end
end
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2661 次 |
| 最近记录: |