Commit 5f71dcd73925a5036f9954a1225926b7326a3e30
1 parent
310b4fcd
Exists in
master
and in
1 other branch
Made error fingerprints a bit smarter for JS errors - Use first backtrace file a…
…nd line number, and fall back to error message.
Showing
1 changed file
with
10 additions
and
3 deletions
Show diff stats
app/models/error_report.rb
@@ -58,10 +58,17 @@ class ErrorReport | @@ -58,10 +58,17 @@ class ErrorReport | ||
58 | 58 | ||
59 | private | 59 | private |
60 | def fingerprint_source | 60 | def fingerprint_source |
61 | - # If backtrace is blank, use notice message for fingerprint | ||
62 | - backtrace_or_message = backtrace.lines.any? ? backtrace.id : message | 61 | + # Find the first backtrace line with a file and line number. |
62 | + if line = backtrace.lines.detect {|l| l.number.present? && l.file.present? } | ||
63 | + # If line exists, only use file and number. | ||
64 | + file_or_message = "#{line.file}:#{line.number}" | ||
65 | + else | ||
66 | + # If no backtrace, use error message | ||
67 | + file_or_message = message | ||
68 | + end | ||
69 | + | ||
63 | { | 70 | { |
64 | - :backtrace_or_message => backtrace_or_message, | 71 | + :file_or_message => file_or_message, |
65 | :error_class => error_class, | 72 | :error_class => error_class, |
66 | :component => component, | 73 | :component => component, |
67 | :action => action, | 74 | :action => action, |