Commit 795b9de3e40bbe4ceebc7386bc1ced166d096725
1 parent
93030e53
Exists in
master
and in
1 other branch
Display full info on Errs#show page
Showing
10 changed files
with
91 additions
and
12 deletions
Show diff stats
| ... | ... | @@ -0,0 +1,20 @@ |
| 1 | +module HashHelper | |
| 2 | + | |
| 3 | + def pretty_hash(hash, nesting = 0) | |
| 4 | + tab_size = 2 | |
| 5 | + nesting += 1 | |
| 6 | + | |
| 7 | + pretty = "{" | |
| 8 | + sorted_keys = hash.keys.sort | |
| 9 | + sorted_keys.each do |key| | |
| 10 | + val = hash[key].is_a?(Hash) ? pretty_hash(hash[key], nesting) : hash[key].inspect | |
| 11 | + pretty += "\n#{' '*nesting*tab_size}" | |
| 12 | + pretty += "#{key.inspect} => #{val}" | |
| 13 | + pretty += "," unless key == sorted_keys.last | |
| 14 | + | |
| 15 | + end | |
| 16 | + nesting -= 1 | |
| 17 | + pretty += "\n#{' '*nesting*tab_size}}" | |
| 18 | + end | |
| 19 | + | |
| 20 | +end | |
| 0 | 21 | \ No newline at end of file | ... | ... |
app/models/err.rb
app/models/notice.rb
| ... | ... | @@ -19,6 +19,9 @@ class Notice |
| 19 | 19 | hoptoad_notice = Hoptoad::V2.parse_xml(hoptoad_xml) |
| 20 | 20 | project = Project.find_by_api_key!(hoptoad_notice['api-key']) |
| 21 | 21 | |
| 22 | + hoptoad_notice['request']['component'] = 'unknown' if hoptoad_notice['request']['component'].blank? | |
| 23 | + hoptoad_notice['request']['action'] = nil if hoptoad_notice['request']['action'].blank? | |
| 24 | + | |
| 22 | 25 | error = Err.for({ |
| 23 | 26 | :project => project, |
| 24 | 27 | :klass => hoptoad_notice['error']['class'], |
| ... | ... | @@ -36,6 +39,22 @@ class Notice |
| 36 | 39 | }) |
| 37 | 40 | end |
| 38 | 41 | |
| 42 | + def request | |
| 43 | + read_attribute(:request) || {} | |
| 44 | + end | |
| 45 | + | |
| 46 | + def env_vars | |
| 47 | + request['cgi-data'] || {} | |
| 48 | + end | |
| 49 | + | |
| 50 | + def params | |
| 51 | + request['params'] || {} | |
| 52 | + end | |
| 53 | + | |
| 54 | + def session | |
| 55 | + request['session'] || {} | |
| 56 | + end | |
| 57 | + | |
| 39 | 58 | def deliver_notification |
| 40 | 59 | Mailer.error_notification(self).deliver |
| 41 | 60 | end | ... | ... |
app/views/errs/show.html.haml
| ... | ... | @@ -14,6 +14,18 @@ |
| 14 | 14 | = link_to "back to '#{@project.name}'", project_path(@project) |
| 15 | 15 | | |
| 16 | 16 | = link_to 'resolve', '#' if @err.unresolved? |
| 17 | - | |
| 17 | + | |
| 18 | +%h3#summary Summary | |
| 19 | += render 'notices/summary', :notice => @notice | |
| 20 | + | |
| 18 | 21 | %h3#backtrace Backtrace |
| 19 | -= render 'notices/backtrace', :lines => @notice.backtrace | |
| 20 | 22 | \ No newline at end of file |
| 23 | += render 'notices/backtrace', :lines => @notice.backtrace | |
| 24 | + | |
| 25 | +%h3#environment Environment | |
| 26 | += render 'notices/environment', :notice => @notice | |
| 27 | + | |
| 28 | +%h3#params Parameters | |
| 29 | += render 'notices/params', :notice => @notice | |
| 30 | + | |
| 31 | +%h3#session Session | |
| 32 | += render 'notices/session', :notice => @notice | |
| 21 | 33 | \ No newline at end of file | ... | ... |
app/views/notices/_backtrace.html.haml
| ... | ... | @@ -0,0 +1,13 @@ |
| 1 | +%table.summary | |
| 2 | + %tr | |
| 3 | + %th URL | |
| 4 | + %td.main= notice.request['url'] | |
| 5 | + %tr | |
| 6 | + %th Where | |
| 7 | + %td= notice.err.where | |
| 8 | + %tr | |
| 9 | + %th Occurred | |
| 10 | + %td= notice.created_at.to_s(:micro) | |
| 11 | + %tr | |
| 12 | + %th Similar | |
| 13 | + %td= notice.err.notices.count - 1 | |
| 0 | 14 | \ No newline at end of file | ... | ... |
public/stylesheets/application.css
| ... | ... | @@ -203,6 +203,9 @@ td.deploy { |
| 203 | 203 | td.latest { |
| 204 | 204 | white-space: nowrap; |
| 205 | 205 | } |
| 206 | +td.count { | |
| 207 | + text-align: right; | |
| 208 | +} | |
| 206 | 209 | |
| 207 | 210 | /* Err Tables */ |
| 208 | 211 | table.errs td.message a { |
| ... | ... | @@ -214,30 +217,31 @@ table.errs td.message em { |
| 214 | 217 | } |
| 215 | 218 | |
| 216 | 219 | /* Backtrace */ |
| 217 | -.backtrace { | |
| 220 | +.window { | |
| 218 | 221 | width: 100%; |
| 222 | + margin-bottom: 1em; | |
| 219 | 223 | overflow: auto; |
| 220 | 224 | } |
| 221 | -.backtrace table { | |
| 225 | +.window table { | |
| 222 | 226 | margin: 0; |
| 223 | 227 | } |
| 224 | -.backtrace td { | |
| 228 | +table.backtrace td { | |
| 225 | 229 | width: 100%; |
| 226 | 230 | padding: 0; |
| 227 | 231 | margin: 0; |
| 228 | 232 | color: #A2A2A2; |
| 229 | 233 | background-color: #222 !important; |
| 230 | 234 | } |
| 231 | -.backtrace ul.line-numbers li { | |
| 235 | +table.backtrace ul.line-numbers li { | |
| 232 | 236 | text-align: right; |
| 233 | 237 | } |
| 234 | -.backtrace ul.lines { | |
| 238 | +table.backtrace ul.lines { | |
| 235 | 239 | padding: 10px 8px; |
| 236 | 240 | overflow: auto; |
| 237 | 241 | } |
| 238 | -.backtrace li { | |
| 242 | +table.backtrace li { | |
| 239 | 243 | white-space: nowrap; |
| 240 | 244 | } |
| 241 | -.backtrace li.in-project { | |
| 245 | +table.backtrace li.in-project { | |
| 242 | 246 | color: #2adb2e; |
| 243 | 247 | } |
| 244 | 248 | \ No newline at end of file | ... | ... |