对 ruby/rails 异常堆栈感到困惑
我正在与这个异常作斗争:
ActionView::TemplateError (incompatible character encodings: UTF-8 and ASCII-8BIT) on line #5 of app/views/retain/qs/_qs_row.html.erb:
那是来自模板,并且异常以:
app/helpers/retain/qs_helper.rb:111:in `render_row'
app/views/retain/qs/_qs_row.html.erb:5
...
该行代码是:
cache(tag) do
...
end
在那一点上我很困惑。根据堆栈,我们不在缓存内,也不在缓存产生的块内——让我们以某种方式在某个地方对两个字符串进行操作(可能将它们连接起来)。我如何找出该操作发生的位置以及参数等正在使用?
令人沮丧的是,我无法自己重新创建它,我必须将其放入我的暂存环境中,并让我在韩国的一个用户(实际上是两个)遇到它
。如果我提出建议会有帮助吗?救援,捕获异常,然后自己打印堆栈吗?它会包含更多行吗?
I am fighting this exception:
ActionView::TemplateError (incompatible character encodings: UTF-8 and ASCII-8BIT) on line #5 of app/views/retain/qs/_qs_row.html.erb:
That is from a template and the excpetion starts with:
app/helpers/retain/qs_helper.rb:111:in `render_row'
app/views/retain/qs/_qs_row.html.erb:5
...
That line of code is:
cache(tag) do
...
end
And at that point I'm confused. According to the stack, we are not inside cache nor are we inside the block that cache yields to -- let we are somehow, somewhere, operating on two strings (probably concatenating them. How do I find out where that operation is happening and the parameters, etc being used?
The frustrating thing also is that I can not recreate this myself. I have to put this into my staging environment and let one of my users in Korea (two of them actually) bump into it.
Anyone have any debugging suggestions? Would it help if I put a rescue in, catch the exception, and print the stack out myself? Would it include more lines?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我添加了自己的救援,然后记录了异常的回溯。它包含比正常打印的堆栈级别低的几个堆栈级别。在我的例子中,异常来自内存缓存内部。
我不确定为什么 Rails 异常处理程序不显示堆栈的前 6 层左右。
I added my own rescue and then logged the exception's backtrace. It contained several stack levels below the one that was printed out normally. The exception is coming from within memcache in my case.
I am not sure why the Rails exception handler is not displaying the first 6 or so levels of the stack.
将这一行添加到您的
qs_helper.rb
帮助程序文件中 相关主题
add to your
qs_helper.rb
helper file this lineRelated topic