Exception: Exception
- Defined in:
- lib/rmtools/dev/trace_format.rb
Overview
Usage with Rails. Rails raise and rescue a bunch of exceptions during a first load, a reload of code (e.g. in development env) and maybe even some exceptions for each request. Thus, trace_format should be set only in a console environment after a code is loaded. For a web-server environment use RMTools.format_trace for inspect backtrace after an exception was rescued. Also note that Rails’ autoreload of code won’t rewrite SCRIPT_LINES__.
Instance Method Summary collapse
-
#set_backtrace(src) ⇒ Object
If you also set (e.g. in irbrc file) module Readline alias :orig_readline :readline def readline(*args) ln = orig_readline(*args) SCRIPT_LINES__ << “#lnn” ln end end it will be possible to fetch lines entered in IRB else format_trace would only read ordinally require’d files.
- #set_bt ⇒ Object
Instance Method Details
#set_backtrace(src) ⇒ Object
If you also set (e.g. in irbrc file)
module Readline
alias :orig_readline :readline
def readline(*args)
ln = orig_readline(*args)
SCRIPT_LINES__['(irb)'] << "#{ln}\n"
ln
end
end
it will be possible to fetch lines entered in IRB else format_trace would only read ordinally require’d files
107 108 109 110 111 112 |
# File 'lib/rmtools/dev/trace_format.rb', line 107 def set_backtrace src if format = self.class.trace_format src = RMTools.__send__ format, src end set_bt src end |
#set_bt ⇒ Object
93 |
# File 'lib/rmtools/dev/trace_format.rb', line 93 alias :set_bt :set_backtrace |