对 ruby​​/rails 异常堆栈感到困惑

发布于 2024-12-08 08:02:12 字数 604 浏览 1 评论 0原文

我正在与这个异常作斗争:

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

独行侠 2024-12-15 08:02:13

我添加了自己的救援,然后记录了异常的回溯。它包含比正常打印的堆栈级别低的几个堆栈级别。在我的例子中,异常来自内存缓存内部。

我不确定为什么 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.

决绝 2024-12-15 08:02:12

将这一行添加到您的 qs_helper.rb 帮助程序文件

# encoding: utf-8

中 相关主题

将“#coding: utf-8”添加到所有文件

add to your qs_helper.rb helper file this line

# encoding: utf-8

Related topic

Add "# coding: utf-8" to all files

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文