我正在测试一个使用 rails 构建的应用程序,并且不时出现错误
当它发生时,会发生 ActionView::TemplateError 并登录到 log/production.log
我如何抓住它和 f.ex。每当它发生在应用程序的某个地方时,通过电子邮件发送给自己?
最好的方法是什么?
前任 在具有某种 before_filter 的 ApplicationController 中?
代码是,我想
before_filter :app_error_catch
def app_error_catch
begin
rescue ActionView::TemplateError
Mailer.deliver_apperror(errormessage)
end
end
这接近事实吗?以及如何获得“错误消息”?
谢谢你