exception_handling 3.0.pre.1 → 3.0.0.pre.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +5 -5
  2. data/.github/CODEOWNERS +1 -0
  3. data/.github/workflows/pipeline.yml +36 -0
  4. data/.gitignore +3 -0
  5. data/.rspec +3 -0
  6. data/.ruby-version +1 -1
  7. data/.tool-versions +1 -0
  8. data/Appraisals +13 -0
  9. data/CHANGELOG.md +150 -0
  10. data/Gemfile +10 -16
  11. data/Gemfile.lock +65 -128
  12. data/README.md +51 -19
  13. data/Rakefile +8 -11
  14. data/exception_handling.gemspec +11 -13
  15. data/gemfiles/rails_5.gemfile +16 -0
  16. data/gemfiles/rails_6.gemfile +16 -0
  17. data/gemfiles/rails_7.gemfile +16 -0
  18. data/lib/exception_handling/escalate_callback.rb +19 -0
  19. data/lib/exception_handling/exception_info.rb +15 -11
  20. data/lib/exception_handling/log_stub_error.rb +2 -1
  21. data/lib/exception_handling/logging_methods.rb +21 -0
  22. data/lib/exception_handling/testing.rb +9 -12
  23. data/lib/exception_handling/version.rb +1 -1
  24. data/lib/exception_handling.rb +83 -173
  25. data/{test → spec}/helpers/exception_helpers.rb +2 -2
  26. data/spec/rake_test_warning_false.rb +20 -0
  27. data/{test/test_helper.rb → spec/spec_helper.rb} +63 -66
  28. data/spec/unit/exception_handling/escalate_callback_spec.rb +81 -0
  29. data/spec/unit/exception_handling/exception_catalog_spec.rb +85 -0
  30. data/spec/unit/exception_handling/exception_description_spec.rb +82 -0
  31. data/{test/unit/exception_handling/exception_info_test.rb → spec/unit/exception_handling/exception_info_spec.rb} +170 -114
  32. data/{test/unit/exception_handling/log_error_stub_test.rb → spec/unit/exception_handling/log_error_stub_spec.rb} +38 -22
  33. data/spec/unit/exception_handling/logging_methods_spec.rb +38 -0
  34. data/spec/unit/exception_handling_spec.rb +1063 -0
  35. metadata +60 -89
  36. data/lib/exception_handling/honeybadger_callbacks.rb +0 -59
  37. data/lib/exception_handling/mailer.rb +0 -70
  38. data/lib/exception_handling/methods.rb +0 -101
  39. data/lib/exception_handling/sensu.rb +0 -28
  40. data/semaphore_ci/setup.sh +0 -3
  41. data/test/unit/exception_handling/exception_catalog_test.rb +0 -85
  42. data/test/unit/exception_handling/exception_description_test.rb +0 -82
  43. data/test/unit/exception_handling/honeybadger_callbacks_test.rb +0 -122
  44. data/test/unit/exception_handling/mailer_test.rb +0 -98
  45. data/test/unit/exception_handling/methods_test.rb +0 -84
  46. data/test/unit/exception_handling/sensu_test.rb +0 -52
  47. data/test/unit/exception_handling_test.rb +0 -1109
  48. data/views/exception_handling/mailer/escalate_custom.html.erb +0 -17
  49. data/views/exception_handling/mailer/escalation_notification.html.erb +0 -17
  50. data/views/exception_handling/mailer/log_parser_exception_notification.html.erb +0 -82
  51. /data/{test → spec}/helpers/controller_helpers.rb +0 -0
@@ -1,17 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
- <head>
5
- <title>Exception Escalation</title>
6
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
7
- </head>
8
- <body>
9
- <h3><%=h @summary %></h3>
10
- <b>Error #:</b> <%= h(@cleaned_data[:timestamp]).presence || '<i>no error #</i>'.html_safe -%><br />
11
- <b>Exception:</b> <%= h(@cleaned_data[:error_string]).gsub("\n","<br/>\n").gsub(/ {2,}/) { |spaces| '&nbsp;'*spaces.size }.html_safe %><br />
12
- <b>Server:</b> <%= h(@server).presence || '<i>hostname not set</i>'.html_safe -%><br />
13
- <% if @cleaned_data[:scm_revision] %>
14
- <b>Revision:</b> <%= @cleaned_data[:scm_revision] %><br />
15
- <% end %>
16
- </body>
17
- </html>
@@ -1,17 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
- <head>
5
- <title>Exception Escalation</title>
6
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
7
- </head>
8
- <body>
9
- <h3><%=h @summary %></h3>
10
- <b>Error #:</b> <%= h(@cleaned_data[:timestamp]).presence || '<i>no error #</i>'.html_safe -%><br />
11
- <b>Exception:</b> <%= h(@cleaned_data[:error_string]).gsub("\n","<br/>\n").gsub(/ {2,}/) { |spaces| '&nbsp;'*spaces.size }.html_safe %><br />
12
- <b>Server:</b> <%= h(@server).presence || '<i>hostname not set</i>'.html_safe -%><br />
13
- <% if @cleaned_data[:scm_revision] %>
14
- <b>Revision:</b> <%= @cleaned_data[:scm_revision] %><br />
15
- <% end %>
16
- </body>
17
- </html>
@@ -1,82 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
- <head>
5
- <title>Exception Email</title>
6
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
7
- </head>
8
- <body>
9
-
10
- <% if @cleaned_data[:first_seen_at] %>
11
- <p> This exception occurred <%= @cleaned_data[:occurrences] %> times since <%= @cleaned_data[:first_seen_at] %>.</p>
12
- <% end %>
13
-
14
- <b>Error # </b><%= @cleaned_data[:timestamp] -%><br />
15
-
16
- <b>URL:</b><br />
17
- <% if (request = @cleaned_data[:request]) %>
18
- <%= request[:url] || '<i>no URL in request data</i>'.html_safe %> <br />
19
- Referred from: <%= (@cleaned_data[:environment]['HTTP_REFERER'] || '<i>no referrer</i>').html_safe %>
20
- <% else %>
21
- <i>no URL accessed</i>
22
- <% end %>
23
- <br />
24
- <br />
25
-
26
- <b>User summary:</b><br />
27
- <% if (user_details = @cleaned_data[:user_details]) && ( user_details[:user] || user_details[:organization] ) %>
28
- User: <%= h user_details[:user] %> (<%= h user_details[:username] %>)<br />
29
- Organization: <%= user_details[:organization] %> <br />
30
- <%= "Network: #{h user_details[:organization].network if user_details[:organization]}" if !user_details[:organization].is_a?(Network) %>
31
-
32
- <% if @cleaned_data[:user_details][:impersonated_organization] %>
33
- <br />
34
- <b>Impersonating:</b><br />
35
- Organization: <%= h @cleaned_data[:user_details][:impersonated_organization] %>
36
- <% end %>
37
- <% else %>
38
- <i>No user logged in.</i>
39
- <% end %>
40
-
41
- <br />
42
- <br />
43
- <hr />
44
-
45
- <h3>Exception:</h3>
46
- <span id="error">
47
- <%= h(@cleaned_data[:error]).gsub("\n","<br/>\n").gsub(/ {2,}/) { |spaces| '&nbsp;'*spaces.size }.html_safe %>
48
- </span>
49
-
50
- <br />
51
- <br />
52
-
53
- <h3>Where:</h3>
54
- <%= "#{ h location[:controller]}##{ h location[:action]}<br />".html_safe if (location = @cleaned_data[:location]) && location[:controller] -%>
55
- <%= "#{ h location[:file]}, line #{ h location[:line]}<br />".html_safe if (location = @cleaned_data[:location]) && location[:file] -%>
56
-
57
- <br />
58
-
59
-
60
-
61
- <% for section in ExceptionHandling::ExceptionInfo::SECTIONS %>
62
- <% section_value = @cleaned_data[section] %>
63
- <% if section_value %>
64
- <h3><%= section.to_s.capitalize -%>:</h3>
65
- <pre id="<%= section.to_s.capitalize -%>" style="font-size: 12px; font-family: 'Courier New',Arial,sans-serif">
66
- <%= case section_value
67
- when Hash
68
- section_value[:to_s]
69
- when Array
70
- section_value.join( "\n" )
71
- when NilClass # omitted
72
- else
73
- raise "Unexpected value #{section_value.inspect} for section #{section}"
74
- end
75
- -%>
76
- </pre>
77
- <% end %>
78
-
79
- <% end %>
80
-
81
- </body>
82
- </html>
File without changes