public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Search Repo:
Remove generated code from app traces; improve accuracy of framework 
traces

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2676 
5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Nicholas Seckar (author)
Tue Oct 18 07:06:34 -0700 2005
commit  60b6fac5deec3317acaca8dc3d399faea25223b2
tree    2c9628661e6286baad8f9f81ec81781da1a8c66e
parent  851dd0806be4e21f9a4fdcc77162711f46095bc5
...
 
 
 
 
 
1
2
3
...
1
2
3
4
5
6
7
8
0
@@ -1,3 +1,8 @@
0
+* Classify generated routing code as framework code to avoid appearing in application traces. [Nicholas Seckar]
0
+
0
+* Show all framework frames in the framework trace. [Nicholas Seckar]
0
+
0
+
0
 *1.2.0* (October 16th, 2005)
0
 
0
 * Update Exception extension to show the first few framework frames in an application trace. [Nicholas Seckar]
...
3
4
5
 
6
7
8
9
...
16
17
18
19
 
20
21
22
 
 
 
 
23
24
...
3
4
5
6
7
8
9
10
...
17
18
19
 
20
21
22
23
24
25
26
27
28
29
0
@@ -3,6 +3,7 @@
0
   alias :clean_message :message
0
   
0
   TraceSubstitutions = []
0
+ FrameworkRegexp = /generated_code|vendor|dispatch|ruby|script\/\w+/
0
   
0
   def clean_backtrace
0
     backtrace.collect do |line|
0
0
@@ -16,10 +17,14 @@
0
     before_application_frame = true
0
     
0
     clean_backtrace.reject do |line|
0
- non_app_frame = !! (line =~ /vendor|dispatch|ruby|script\/\w+/)
0
+ non_app_frame = !! (line =~ FrameworkRegexp)
0
       before_application_frame = false unless non_app_frame
0
       non_app_frame && ! before_application_frame
0
     end
0
+ end
0
+
0
+ def framework_backtrace
0
+ clean_backtrace.select {|line| line =~ FrameworkRegexp}
0
   end
0
 end
...
34
35
36
 
 
 
 
 
 
 
 
37
38
...
34
35
36
37
38
39
40
41
42
43
44
45
46
0
@@ -34,6 +34,14 @@
0
     assert_kind_of Exception, e
0
     assert_equal ['vendor/file.rb some stuff', 'bhal.rb', 'almost all'], e.application_backtrace
0
   end
0
+
0
+ def test_framework_backtrace_with_before
0
+ Exception::TraceSubstitutions << [/\s*hidden.*/, '']
0
+ e = get_exception RuntimeError, 'RAWR', ['vendor/file.rb some stuff', 'bhal.rb', ' vendor/file.rb some stuff', 'almost all']
0
+ assert_kind_of Exception, e
0
+ assert_equal ['vendor/file.rb some stuff', ' vendor/file.rb some stuff'], e.framework_backtrace
0
+ end
0
+
0
   
0
 end

Comments

    No one has commented yet.