Nexus Weblogging
ChinaonRails
You are here ChinaonRails > Ruby on Rails > > rails 异常处理

老熊


0.208%

disconnected
登录后回复主题 | 跳到回复

rails 异常处理

... by 老熊 ... 3 月 19 天前 ... 132 次点击

原来异常处理都是比较简单的
begin
....
rescue Exception => exc
logger.error("#{exc.message}")
redirect_to "/500.html"
end

但发现如果在 activerecode中的错误,那么可以处理得到,但如果是action_controller的错误,如DoubleRender、noaction等无法,则需要改成
begin
raise
....
rescue Exception => exc
logger.error("#{exc.message}")
redirect_to "/500.html"
end
才能处理到,不知道大家如何处理的,有什么好办法没有

目前这个主题还没有回复,或许你可以帮楼主加盖一层?

在回复之前你需要先进行登录
电子邮件或昵称
密码
© 2007 A Jesse Cai Production   -   About   -   京ICP备07020911号
a site powered by Project Babel