简体   繁体   中英

Rails: errors in production vs development

在Rails中,有没有一种方法可以在生产Rails服务器(漂亮的图形)和开发服务器上显示不同的错误消息(详细的错误信息,堆栈跟踪等)?

Found one solution . In ApplicationController, add:

rescue_from Exception, :with => :rescue_all_exceptions if RAILS_ENV == 'production'

def rescue_all_exceptions(exception)
  case exception
    # do production-ey exception stuff
  end
end

I'd be interested to hear other options...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM