水豚服务器和浏览器错误,在服务器上没有任何痕迹
Capybara server & browser error with no trace on server
出于某种原因,我的一个黄瓜测试似乎在 poltergeist 驱动程序和 rails 服务器上都失败了。
我在浏览器崩溃时得到了完整的跟踪,但在服务器端几乎没有。
当我打开 Capybara 屏幕截图时,我只看到了
Internal Server Error
undefined method name
for nil:NilClass
当我尾随 test.log
Completed 500 Internal Server Error in 0ms (Elasticsearch: 0.0ms)
(且无迹)
我试过了
- 设置
config.action_dispatch.show_exceptions = true
b
标志(但它只显示水豚错误的详细跟踪
- (我的配置级别设置为 :debug 已经在我的环境文件中)
如何在服务器端获得完整的回溯?
编辑
- 水豚 2.13.0
- Rails 5.0.2
- backtrace_silencers
中的所有评论
我从 this answer 那里得到了一些东西!
所以解决方案是允许拯救 ActionController::Base 中的异常。在我的 env 文件中,我有以下误导性的行
# There are two ways to allow Rails to rescue exceptions:
#
# 1) Tag your scenario (or feature) with @allow-rescue
#
# 2) Set the value below to true. Beware that doing this globally is not
# recommended as it will mask a lot of errors for you!
#
ActionController::Base.allow_rescue = false
通过添加 @allow-rescue 标签,我的 test.log
中显示了更全面的错误跟踪以及前端错误视图
如果你(像我一样)不使用 Cucumber 但 Capybara this answer 也可能对你有帮助。
在config/environments/test.rb
设置
config.action_dispatch.show_exceptions = true
出于某种原因,我的一个黄瓜测试似乎在 poltergeist 驱动程序和 rails 服务器上都失败了。
我在浏览器崩溃时得到了完整的跟踪,但在服务器端几乎没有。
当我打开 Capybara 屏幕截图时,我只看到了
Internal Server Error undefined method
name
for nil:NilClass
当我尾随 test.log
Completed 500 Internal Server Error in 0ms (Elasticsearch: 0.0ms)
(且无迹)
我试过了
- 设置
config.action_dispatch.show_exceptions = true
b
标志(但它只显示水豚错误的详细跟踪- (我的配置级别设置为 :debug 已经在我的环境文件中)
如何在服务器端获得完整的回溯?
编辑
- 水豚 2.13.0
- Rails 5.0.2
- backtrace_silencers 中的所有评论
我从 this answer 那里得到了一些东西!
所以解决方案是允许拯救 ActionController::Base 中的异常。在我的 env 文件中,我有以下误导性的行
# There are two ways to allow Rails to rescue exceptions:
#
# 1) Tag your scenario (or feature) with @allow-rescue
#
# 2) Set the value below to true. Beware that doing this globally is not
# recommended as it will mask a lot of errors for you!
#
ActionController::Base.allow_rescue = false
通过添加 @allow-rescue 标签,我的 test.log
中显示了更全面的错误跟踪以及前端错误视图
如果你(像我一样)不使用 Cucumber 但 Capybara this answer 也可能对你有帮助。
在config/environments/test.rb
设置
config.action_dispatch.show_exceptions = true