简体   繁体   中英

Confused by ruby / rails exception stack

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?

add to your qs_helper.rb helper file this line

# encoding: utf-8

Related topic

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

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.

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