Commit e7ff4c6f065acbd1b3ea71f97aa87cb7035cdb82
1 parent
2004caa4
Exists in
master
and in
1 other branch
Further changes for github issue #56: Issue tracker templates were forgotten whe…
…n fixing the backtrace 'missing files' problem. I added the '[unknown file]' check to the sanitize method on notices, which runs from a before_save filter. Also, doesn't hurt to ensure that line['file'] is a string.
Showing
7 changed files
with
10 additions
and
7 deletions
Show diff stats
app/models/notice.rb
@@ -107,6 +107,8 @@ class Notice | @@ -107,6 +107,8 @@ class Notice | ||
107 | [:server_environment, :request, :notifier].each do |h| | 107 | [:server_environment, :request, :notifier].each do |h| |
108 | send("#{h}=",sanitize_hash(send(h))) | 108 | send("#{h}=",sanitize_hash(send(h))) |
109 | end | 109 | end |
110 | + # Set unknown backtrace files | ||
111 | + backtrace.each{|line| line['file'] = "[unknown source]" if line['file'].blank? } | ||
110 | end | 112 | end |
111 | 113 | ||
112 | def sanitize_hash(h) | 114 | def sanitize_hash(h) |
app/views/issue_trackers/fogbugz_body.txt.erb
@@ -20,7 +20,7 @@ | @@ -20,7 +20,7 @@ | ||
20 | 20 | ||
21 | Backtrace | 21 | Backtrace |
22 | <% for line in notice.backtrace %> | 22 | <% for line in notice.backtrace %> |
23 | - <%= line['number'] %>: <%= line['file'].sub(/^\[PROJECT_ROOT\]/, '') %> | 23 | + <%= line['number'] %>: <%= line['file'].to_s.sub(/^\[PROJECT_ROOT\]/, '') %> |
24 | <% end %> | 24 | <% end %> |
25 | 25 | ||
26 | Environment | 26 | Environment |
app/views/issue_trackers/github_issues_body.txt.erb
@@ -27,7 +27,7 @@ | @@ -27,7 +27,7 @@ | ||
27 | 27 | ||
28 | ## Backtrace ## | 28 | ## Backtrace ## |
29 | ``` | 29 | ``` |
30 | -<% for line in notice.backtrace %><%= line['number'] %>: <%= line['file'].sub(/^\[PROJECT_ROOT\]/, '') %> -> **<%= line['method'] %>** | 30 | +<% for line in notice.backtrace %><%= line['number'] %>: <%= line['file'].to_s.sub(/^\[PROJECT_ROOT\]/, '') %> -> **<%= line['method'] %>** |
31 | <% end %> | 31 | <% end %> |
32 | ``` | 32 | ``` |
33 | 33 |
app/views/issue_trackers/lighthouseapp_body.txt.erb
@@ -23,7 +23,7 @@ | @@ -23,7 +23,7 @@ | ||
23 | 23 | ||
24 | ## Backtrace ## | 24 | ## Backtrace ## |
25 | <code> | 25 | <code> |
26 | - <% for line in notice.backtrace %><%= line['number'] %>: <%= line['file'].sub(/^\[PROJECT_ROOT\]/, '') %> -> **<%= line['method'] %>** | 26 | + <% for line in notice.backtrace %><%= line['number'] %>: <%= line['file'].to_s.sub(/^\[PROJECT_ROOT\]/, '') %> -> **<%= line['method'] %>** |
27 | <% end %> | 27 | <% end %> |
28 | </code> | 28 | </code> |
29 | 29 | ||
@@ -32,3 +32,4 @@ | @@ -32,3 +32,4 @@ | ||
32 | <%= key %>: <%= val %> | 32 | <%= key %>: <%= val %> |
33 | <% end %> | 33 | <% end %> |
34 | <% end %> | 34 | <% end %> |
35 | + |
app/views/issue_trackers/pivotal_body.txt.erb
@@ -12,5 +12,6 @@ See this exception on Errbit: <%= app_err_url err.app, err %> | @@ -12,5 +12,6 @@ See this exception on Errbit: <%= app_err_url err.app, err %> | ||
12 | <%= pretty_hash notice.session %> | 12 | <%= pretty_hash notice.session %> |
13 | 13 | ||
14 | Backtrace: | 14 | Backtrace: |
15 | - <%= notice.backtrace[0..4].map { |line| "#{line['number']}: #{line['file'].sub(/^\[PROJECT_ROOT\]/, '')} -> *#{line['method']}*" }.join "\n" %> | 15 | + <%= notice.backtrace[0..4].map { |line| "#{line['number']}: #{line['file'].to_s.sub(/^\[PROJECT_ROOT\]/, '')} -> *#{line['method']}*" }.join "\n" %> |
16 | <% end %> | 16 | <% end %> |
17 | + |
app/views/issue_trackers/textile_body.txt.erb
@@ -32,7 +32,7 @@ h2. Session | @@ -32,7 +32,7 @@ h2. Session | ||
32 | h2. Backtrace | 32 | h2. Backtrace |
33 | 33 | ||
34 | | Line | File | Method | | 34 | | Line | File | Method | |
35 | -<% for line in notice.backtrace %>| <%= line['number'] %> | <%= line['file'].sub(/^\[PROJECT_ROOT\]/, '') %> | *<%= line['method'] %>* | | 35 | +<% for line in notice.backtrace %>| <%= line['number'] %> | <%= line['file'].to_s.sub(/^\[PROJECT_ROOT\]/, '') %> | *<%= line['method'] %>* | |
36 | <% end %> | 36 | <% end %> |
37 | 37 | ||
38 | h2. Environment | 38 | h2. Environment |
app/views/notices/_backtrace.html.haml
@@ -9,8 +9,7 @@ | @@ -9,8 +9,7 @@ | ||
9 | %td | 9 | %td |
10 | %ul.lines | 10 | %ul.lines |
11 | - lines.each do |line| | 11 | - lines.each do |line| |
12 | - - line['file'] = "[unknown source]" if line['file'].blank? | ||
13 | - - in_app = line['file'].gsub!('[PROJECT_ROOT]','') && !line['file'].match(/^\/vendor\//) | 12 | + - in_app = line['file'].to_s.gsub!('[PROJECT_ROOT]','') && !line['file'].to_s.match(/^\/vendor\//) |
14 | %li{:class => (in_app ? 'in-app' : nil)} | 13 | %li{:class => (in_app ? 'in-app' : nil)} |
15 | = line['file'] | 14 | = line['file'] |
16 | → | 15 | → |