提交 57f43473 编写于 作者: N Nicholas Seckar

Update Exception extension to show the first few framework frames in an application trace.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2654 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 98c1735f
*SVN*
* Added Extension extension to provide support for clean backtraces. [Nicholas Seckar]
* Update Exception extension to show the first few framework frames in an application trace. [Nicholas Seckar]
* Added Exception extension to provide support for clean backtraces. [Nicholas Seckar]
* Updated whiny nil to be more concise and useful. [Nicholas Seckar]
......
......@@ -13,6 +13,12 @@ def clean_backtrace
end
def application_backtrace
clean_backtrace.reject { |line| line =~ /(vendor|dispatch|ruby|script\/\w+)/ }
before_application_frame = true
clean_backtrace.reject do |line|
non_app_frame = !! (line =~ /vendor|dispatch|ruby|script\/\w+/)
before_application_frame = false unless non_app_frame
non_app_frame && ! before_application_frame
end
end
end
\ No newline at end of file
......@@ -21,4 +21,18 @@ def test_clean_backtrace
assert_equal ['bhal.rb', 'rawh hid den stuff is not here', 'almost all'], e.clean_backtrace
end
def test_app_backtrace
Exception::TraceSubstitutions << [/\s*hidden.*/, '']
e = get_exception RuntimeError, 'RAWR', ['bhal.rb', ' vendor/file.rb some stuff', 'almost all']
assert_kind_of Exception, e
assert_equal ['bhal.rb', 'almost all'], e.application_backtrace
end
def test_app_backtrace_with_before
Exception::TraceSubstitutions << [/\s*hidden.*/, '']
e = get_exception RuntimeError, 'RAWR', ['vendor/file.rb some stuff', 'bhal.rb', ' vendor/file.rb some stuff', 'almost all']
assert_kind_of Exception, e
assert_equal ['vendor/file.rb some stuff', 'bhal.rb', 'almost all'], e.application_backtrace
end
end
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册