eschulte/rinari

How to get a pretty backtrace log output in rinari-web-server buffer?

gengliangwang opened this issue · 11 comments

When I raise a runtime error, the backtrace msg is in one line and "C-x `" didn't work:

RuntimeError (Not Found):
  app/controllers/application_controller.rb:386:in `render_404'
  app/controllers/canonical_name_controller.rb:62:in `show_page'
  app/controllers/canonical_name_controller.rb:8:in `index'
  lib/rack/performance.rb:11:in `call' 

So, how to improve this and make the file location(for example, xxx.rb:31) clickable/jumpable?

Works absolutely fine for me with the latest rinari from source or MELPA. Which versions of rails / ruby / rinari / emacs do you have?

(I've just tagged a fresh stable version - 2.11 - so when MELPA Stable builds a fresh package, that should work nicely too.)

I'll go ahead and close this issue: if you can reproduce it with the latest code from git or MELPA, feel free to reopen it.

Hi purcell,
thanks.
The rinari/emacs I am using is up-to-date, however the project I am working on is using ruby 1.9.3, so I the backtrace was bad.
I tried with ruby 2.1.1 and it works.
I am wondering how to make it work for ruby of older version. I might try writing a fix :)

How was the backtrace different? When I compared the one you pasted above with the one I saw in testing (with Ruby 2.1.x) I didn't see any obvious difference.

The backtrace shows up as plain text. There wasn't new lines for each backtrace, and each location like "app/controllers/canonical_name_controller.rb:8" is not mark as read, also I can't click on it for jumping.

No newlines? You mean it looked like

RuntimeError (Not Found):  app/controllers/application_controller.rb:386:in `render_404'

not

RuntimeError (Not Found):
  app/controllers/application_controller.rb:386:in `render_404'

?

P.S. What platform are you on?

for no new lines I mean the backtrace are in one line (when I paste on in this post, the log is parsed..)

I am working on Mac

Hmm. And if you run the server in a terminal window, the backtrace is on multiple lines?

If so, there's probably an encoding issue, e.g. the server buffer is using dos encoding (\r\n) but the process is printing unix line endings (\n). (If you click on the symbol to the left of the : at the beginning of the modeline, it'll describe the coding system for the buffer.)

Hi Purcell,
really appreciate your patient. I start the web server with rinari.
All of the backtrace are one line, instead of multiple lines, and the backtrace is not highlight as red and link.
When rails raise a error:
"a.rb:386:in render_404' b.rb:62:inshow_page' c.rb:8:in `index' "
(syntax error is ok , while raise a runtime error didn't work. What I saw for runtime error is just like turning off the inf-ruby-mode, )

What I expected:
"a.rb:386:in 'render_404'
b.rb:62:in 'show_page'
c.rb:8:in `index' "
a.rb:386 b.rb:63 c.rb:8 is expected to have syntax highlighting.

try running in terminal, all of the backtrace is in just one line as well. So what coding system should the buffer be?