Commit e7ff4c6f065acbd1b3ea71f97aa87cb7035cdb82

Authored by Nathan Broadbent
1 parent 2004caa4
Exists in master and in 1 other branch production

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.
app/models/notice.rb
... ... @@ -107,6 +107,8 @@ class Notice
107 107 [:server_environment, :request, :notifier].each do |h|
108 108 send("#{h}=",sanitize_hash(send(h)))
109 109 end
  110 + # Set unknown backtrace files
  111 + backtrace.each{|line| line['file'] = "[unknown source]" if line['file'].blank? }
110 112 end
111 113  
112 114 def sanitize_hash(h)
... ...
app/views/issue_trackers/fogbugz_body.txt.erb
... ... @@ -20,7 +20,7 @@
20 20  
21 21 Backtrace
22 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 24 <% end %>
25 25  
26 26 Environment
... ...
app/views/issue_trackers/github_issues_body.txt.erb
... ... @@ -27,7 +27,7 @@
27 27  
28 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 31 <% end %>
32 32 ```
33 33  
... ...
app/views/issue_trackers/lighthouseapp_body.txt.erb
... ... @@ -23,7 +23,7 @@
23 23  
24 24 ## Backtrace ##
25 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 27 <% end %>
28 28 </code>
29 29  
... ... @@ -32,3 +32,4 @@
32 32 <%= key %>: <%= val %>
33 33 <% end %>
34 34 <% end %>
  35 +
... ...
app/views/issue_trackers/pivotal_body.txt.erb
... ... @@ -12,5 +12,6 @@ See this exception on Errbit: &lt;%= app_err_url err.app, err %&gt;
12 12 <%= pretty_hash notice.session %>
13 13  
14 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 16 <% end %>
  17 +
... ...
app/views/issue_trackers/textile_body.txt.erb
... ... @@ -32,7 +32,7 @@ h2. Session
32 32 h2. Backtrace
33 33  
34 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 36 <% end %>
37 37  
38 38 h2. Environment
... ...
app/views/notices/_backtrace.html.haml
... ... @@ -9,8 +9,7 @@
9 9 %td
10 10 %ul.lines
11 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 13 %li{:class => (in_app ? 'in-app' : nil)}
15 14 = line['file']
16 15 &rarr;
... ...