exception_notification 4.6.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.rdoc +16 -0
  3. data/CONTRIBUTING.md +23 -51
  4. data/Gemfile +1 -1
  5. data/Gemfile.lock +27 -33
  6. data/README.md +65 -31
  7. data/Rakefile +14 -7
  8. data/exception_notification.gemspec +27 -30
  9. data/gemfiles/pinned_dependencies.gemfile +8 -0
  10. data/gemfiles/rails7_1.gemfile +5 -0
  11. data/gemfiles/rails7_2.gemfile +5 -0
  12. data/gemfiles/rails8_0.gemfile +5 -0
  13. data/lib/exception_notification/rack.rb +4 -4
  14. data/lib/exception_notification/rails.rb +2 -2
  15. data/lib/exception_notification/rake.rb +3 -7
  16. data/lib/exception_notification/resque.rb +2 -2
  17. data/lib/exception_notification/sidekiq.rb +8 -23
  18. data/lib/exception_notification/version.rb +1 -1
  19. data/lib/exception_notification.rb +3 -3
  20. data/lib/exception_notifier/datadog_notifier.rb +26 -26
  21. data/lib/exception_notifier/email_notifier.rb +34 -30
  22. data/lib/exception_notifier/google_chat_notifier.rb +9 -9
  23. data/lib/exception_notifier/hipchat_notifier.rb +12 -12
  24. data/lib/exception_notifier/irc_notifier.rb +6 -6
  25. data/lib/exception_notifier/mattermost_notifier.rb +13 -13
  26. data/lib/exception_notifier/modules/error_grouping.rb +5 -5
  27. data/lib/exception_notifier/modules/formatter.rb +12 -12
  28. data/lib/exception_notifier/notifier.rb +3 -3
  29. data/lib/exception_notifier/slack_notifier.rb +16 -16
  30. data/lib/exception_notifier/sns_notifier.rb +9 -9
  31. data/lib/exception_notifier/teams_notifier.rb +61 -57
  32. data/lib/exception_notifier/webhook_notifier.rb +3 -3
  33. data/lib/exception_notifier.rb +27 -26
  34. data/lib/generators/exception_notification/install_generator.rb +7 -7
  35. data/lib/generators/exception_notification/templates/exception_notification.rb.erb +26 -27
  36. data/test/exception_notification/rack_test.rb +14 -14
  37. data/test/exception_notification/rake_test.rb +13 -13
  38. data/test/exception_notification/resque_test.rb +14 -14
  39. data/test/exception_notifier/datadog_notifier_test.rb +47 -46
  40. data/test/exception_notifier/email_notifier_test.rb +89 -98
  41. data/test/exception_notifier/google_chat_notifier_test.rb +77 -77
  42. data/test/exception_notifier/hipchat_notifier_test.rb +76 -74
  43. data/test/exception_notifier/irc_notifier_test.rb +26 -26
  44. data/test/exception_notifier/mattermost_notifier_test.rb +77 -77
  45. data/test/exception_notifier/modules/error_grouping_test.rb +39 -39
  46. data/test/exception_notifier/modules/formatter_test.rb +51 -49
  47. data/test/exception_notifier/sidekiq_test.rb +17 -10
  48. data/test/exception_notifier/slack_notifier_test.rb +66 -67
  49. data/test/exception_notifier/sns_notifier_test.rb +73 -70
  50. data/test/exception_notifier/teams_notifier_test.rb +33 -33
  51. data/test/exception_notifier/webhook_notifier_test.rb +34 -34
  52. data/test/exception_notifier_test.rb +51 -41
  53. data/test/test_helper.rb +8 -11
  54. metadata +45 -85
  55. data/Appraisals +0 -9
  56. data/gemfiles/rails5_2.gemfile +0 -7
  57. data/gemfiles/rails6_0.gemfile +0 -7
  58. data/gemfiles/rails6_1.gemfile +0 -7
  59. data/gemfiles/rails7_0.gemfile +0 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 658719ace4734ac45fc34d877614b17324e4fca5691c5dcd62a7d6bbec8f74a8
4
- data.tar.gz: 53504d3ff146af281d3667679cec36e8ebb4b55bfa6d916a0e83293bad13f7e9
3
+ metadata.gz: e7052b1e076f4ff2aac2a4aa139d0ddb2a2b6f5b3af1afcc4323e1c8f347db04
4
+ data.tar.gz: 54f3386901d556ec7c3544533d94a5757490645e677b42c325721cef5d4787ae
5
5
  SHA512:
6
- metadata.gz: 3377beb7f90ebb7a083384c87c20662766a1e4c4cd900d2c6010c82708acb1b16e61922fb5b0c8cdda0fd6c00fac6b92b867672498363a3e513898cc2417ed60
7
- data.tar.gz: 6aaab695d7f2836993685b1c98ec43aeb204996ee9ba3edb606787e5c5332f63b8a9d165ef821d0525d44ba6a82612ac55a6c9d2b5c874e8d582e9f7e6ef49bf
6
+ metadata.gz: 68f0a94a1167c436ececbfcf4a48df910e0dd719d3b2385f790a24b285276a48989dbc27cf2e24b26a6e98221cea008192218af4405f6ce954d807b3705357ef
7
+ data.tar.gz: c28bf196e2ce258608c55614d3e42ca8053dc8e7a18b854aa78c8c54fc097f099b9f1d51313a72a7f677b3adb30b0403f7863c90acad78c72ca0e17a5eede527
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,19 @@
1
+ == Unreleased
2
+
3
+ nil
4
+
5
+ == 4.6.0
6
+
7
+ https://github.com/smartinez87/exception_notification/releases/tag/v4.6.0
8
+
9
+ * Rails 8 compatibility (@kmcphillips)
10
+ * Exception data for teams channel notification (@rachitpant)
11
+ * Report exceptions occurring in Rake tasks and runner commands (@TylerRick)
12
+ * suggest Rails.env.local? in ignore_if block (@glaszig)
13
+ * Improve compatibility with frozen string literal (@Throne3d)
14
+ * Remove unnecessary :channel option from Slack guide doc (@westonganger)
15
+ * Add Content-Type header to Slack notifier - req. for discord (@cdadityang)
16
+
1
17
  == 4.5.0
2
18
 
3
19
  * enhancements
data/CONTRIBUTING.md CHANGED
@@ -1,61 +1,33 @@
1
1
  # How to contribute
2
2
 
3
- We love your contribution, for it's essential for making ExceptionNotification greater every day.
4
- In order to keep it as easy as possible to contribute changes, here are a few guidelines that we
5
- need contributors to follow:
3
+ Pull requests welcome! Please try to make them as complete and clear as possible, with reproduction steps and good tests.
6
4
 
7
- ## First of all
8
-
9
- * Check if the issue you're going to submit isn't already submitted in
10
- the [Issues](https://github.com/smartinez87/exception_notification/issues) page.
11
5
 
12
6
  ## Issues
13
7
 
14
- * Submit a ticket for your issue, assuming one does not already exist.
15
- * The issue must:
16
- * Clearly describe the problem including steps to reproduce when it is a bug.
17
- * Also include all the information you can to make it easier for us to reproduce it,
18
- like OS version, gem versions, etc...
19
- * Even better, provide a failing test case for it.
20
-
21
- To help you add information to an issue, you can use the sample_app.
22
- Steps to use sample_app:
23
-
24
- 1) Add your configuration to (ex. with webhook):
25
- ```ruby
26
- config.middleware.use ExceptionNotification::Rack,
27
- # -----------------------------------
28
- # Change this with your configuration
29
- # https://github.com/smartinez87/exception_notification#notifiers
30
- webhook: {
31
- url: 'http://domain.com:5555/hubot/path'
32
- }
33
- # -----------------------------------
34
- ```
8
+ Issues are monitored and responded to, but pull requests are much more likely to be merged.
9
+
10
+ Make sure the issue includes version information, reproduction steps, and any other relevant information.
11
+
12
+ You can use the `examples/sample_app.rb` to help reproduce the issue.
35
13
 
36
- 2) Run `ruby examples/sample_app.rb`
37
- If exception notification is working OK, the test should pass and trigger a notification as configured above. If it's not, you can copy the information printed on the terminal related to exception notification and report an issue with more info!
38
14
 
39
15
  ## Pull Requests
40
16
 
41
- If you've gone the extra mile and have a patch that fixes the issue, you
42
- should submit a Pull Request!
43
-
44
- * Fork the repo on Github.
45
- * Run Bundler and setup your test database
46
-
47
- ```
48
- bundle
49
- cd test/dummy
50
- bundle
51
- bundle exec rake db:reset db:test:prepare
52
- cd ../..
53
- bundle exec rake test
54
- ```
55
- * Create a topic branch from where you want to base your work.
56
- * Add a test for your change. Only refactoring and documentation changes
57
- require no new tests. If you are adding functionality or fixing a bug,
58
- we need a test!
59
- * Run _all_ the tests to assure nothing else was broken. We only take pull requests with passing tests.
60
- * Check for unnecessary whitespace with `git diff --check` before committing.
61
- * Push to your fork and submit a pull request.
17
+ All PRs with changes will be reviewed and merged if possible. Thank you for taking the time to contribute.
18
+
19
+ Changes must include tests. Please include a description of the problem and why the change is needed. Same with issues, reproduction steps are helpful.
20
+
21
+
22
+ ### Running the tests
23
+
24
+ ```bash
25
+ bundle install
26
+ bundle exec rake test
27
+ ```
28
+
29
+ And running the linting with [standard](https://github.com/standardrb/standard):
30
+
31
+ ```bash
32
+ bundle exec standardrb
33
+ ```
data/Gemfile CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- source 'https://rubygems.org'
3
+ source "https://rubygems.org"
4
4
 
5
5
  gemspec
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- exception_notification (4.6.0)
5
- actionmailer (>= 5.2, < 9)
6
- activesupport (>= 5.2, < 9)
4
+ exception_notification (5.0.0)
5
+ actionmailer (>= 7.1, < 9)
6
+ activesupport (>= 7.1, < 9)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
@@ -81,14 +81,10 @@ GEM
81
81
  uri (>= 0.13.1)
82
82
  addressable (2.8.7)
83
83
  public_suffix (>= 2.0.2, < 7.0)
84
- appraisal (2.2.0)
85
- bundler
86
- rake
87
- thor (>= 0.14.0)
88
84
  ast (2.4.3)
89
85
  aws-eventstream (1.3.2)
90
- aws-partitions (1.1070.0)
91
- aws-sdk-core (3.220.1)
86
+ aws-partitions (1.1071.0)
87
+ aws-sdk-core (3.220.2)
92
88
  aws-eventstream (~> 1, >= 1.3.0)
93
89
  aws-partitions (~> 1, >= 1.992.0)
94
90
  aws-sigv4 (~> 1.9)
@@ -107,15 +103,8 @@ GEM
107
103
  addressable
108
104
  concurrent-ruby (1.3.5)
109
105
  connection_pool (2.5.0)
110
- coveralls (0.8.23)
111
- json (>= 1.8, < 3)
112
- simplecov (~> 0.16.1)
113
- term-ansicolor (~> 1.3)
114
- thor (>= 0.19.4, < 2.0)
115
- tins (~> 1.6)
116
106
  crass (1.0.6)
117
107
  date (3.4.1)
118
- docile (1.4.1)
119
108
  dogapi (1.45.0)
120
109
  multi_json
121
110
  drb (2.2.1)
@@ -188,6 +177,7 @@ GEM
188
177
  racc (~> 1.4)
189
178
  nokogiri (1.18.5-x86_64-linux-musl)
190
179
  racc (~> 1.4)
180
+ ostruct (0.6.1)
191
181
  parallel (1.26.3)
192
182
  parser (3.3.7.2)
193
183
  ast (~> 2.4.1)
@@ -258,7 +248,7 @@ GEM
258
248
  redis-namespace (~> 0.4.0)
259
249
  sinatra (>= 0.9.2)
260
250
  vegas (~> 0.1.2)
261
- rubocop (1.74.0)
251
+ rubocop (1.73.2)
262
252
  json (~> 2.3)
263
253
  language_server-protocol (~> 3.17.0.2)
264
254
  lint_roller (~> 1.1.0)
@@ -271,6 +261,10 @@ GEM
271
261
  unicode-display_width (>= 2.4.0, < 4.0)
272
262
  rubocop-ast (1.41.0)
273
263
  parser (>= 3.3.7.2)
264
+ rubocop-performance (1.24.0)
265
+ lint_roller (~> 1.1)
266
+ rubocop (>= 1.72.1, < 2.0)
267
+ rubocop-ast (>= 1.38.0, < 2.0)
274
268
  ruby-progressbar (1.13.0)
275
269
  ruby2_keywords (0.0.5)
276
270
  securerandom (0.4.1)
@@ -280,11 +274,6 @@ GEM
280
274
  logger (>= 1.6.2)
281
275
  rack (>= 3.1.0)
282
276
  redis-client (>= 0.23.2)
283
- simplecov (0.16.1)
284
- docile (~> 1.1)
285
- json (>= 1.8, < 3)
286
- simplecov-html (~> 0.10.0)
287
- simplecov-html (0.10.2)
288
277
  sinatra (4.1.1)
289
278
  logger (>= 1.6.0)
290
279
  mustermann (~> 3.0)
@@ -293,17 +282,23 @@ GEM
293
282
  rack-session (>= 2.0.0, < 3)
294
283
  tilt (~> 2.0)
295
284
  slack-notifier (2.4.0)
285
+ standard (1.47.0)
286
+ language_server-protocol (~> 3.17.0.2)
287
+ lint_roller (~> 1.0)
288
+ rubocop (~> 1.73.0)
289
+ standard-custom (~> 1.0.0)
290
+ standard-performance (~> 1.7)
291
+ standard-custom (1.0.2)
292
+ lint_roller (~> 1.0)
293
+ rubocop (~> 1.50)
294
+ standard-performance (1.7.0)
295
+ lint_roller (~> 1.1)
296
+ rubocop-performance (~> 1.24.0)
296
297
  stringio (3.1.5)
297
- sync (0.5.0)
298
- term-ansicolor (1.11.2)
299
- tins (~> 1.0)
300
298
  thor (1.3.2)
301
299
  tilt (2.6.0)
302
300
  timecop (0.9.10)
303
301
  timeout (0.4.3)
304
- tins (1.38.0)
305
- bigdecimal
306
- sync
307
302
  tzinfo (2.0.6)
308
303
  concurrent-ruby (~> 1.0)
309
304
  unicode-display_width (3.1.4)
@@ -330,10 +325,8 @@ PLATFORMS
330
325
  x86_64-linux-musl
331
326
 
332
327
  DEPENDENCIES
333
- appraisal (~> 2.2.0)
334
328
  aws-sdk-sns (~> 1)
335
329
  carrier-pigeon (>= 0.7.0)
336
- coveralls (~> 0.8.2)
337
330
  dogapi (>= 1.23.0)
338
331
  exception_notification!
339
332
  hipchat (>= 1.0.0)
@@ -341,12 +334,13 @@ DEPENDENCIES
341
334
  mocha (>= 0.13.0)
342
335
  mock_redis (~> 0.19.0)
343
336
  net-smtp
344
- rails (>= 5.2, < 9)
337
+ ostruct
338
+ rails (>= 7.1, < 9)
345
339
  resque (~> 1.8.0)
346
- rubocop
347
340
  sidekiq (>= 5.0.4)
348
341
  slack-notifier (>= 1.0.0)
342
+ standard
349
343
  timecop (~> 0.9.0)
350
344
 
351
345
  BUNDLED WITH
352
- 2.6.3
346
+ 2.6.6
data/README.md CHANGED
@@ -1,52 +1,55 @@
1
1
  # Exception Notification
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/exception_notification.svg)](https://badge.fury.io/rb/exception_notification)
4
- [![Build Status](https://github.com/smartinez87/exception_notification/actions/workflows/main.yml/badge.svg)](https://github.com/smartinez87/exception_notification/actions/workflows/main.yml)
5
- [![Coverage Status](https://coveralls.io/repos/github/smartinez87/exception_notification/badge.svg?branch=master)](https://coveralls.io/github/smartinez87/exception_notification?branch=master)
6
- [![Maintainability](https://api.codeclimate.com/v1/badges/78a9a12be00a6d305136/maintainability)](https://codeclimate.com/github/smartinez87/exception_notification/maintainability)
7
-
8
- **THIS README IS FOR THE MASTER BRANCH AND REFLECTS THE WORK CURRENTLY EXISTING ON THE MASTER BRANCH. IF YOU ARE WISHING TO USE A NON-MASTER BRANCH OF EXCEPTION NOTIFICATION, PLEASE CONSULT THAT BRANCH'S README AND NOT THIS ONE.**
4
+ [![Build Status](https://github.com/kmcphillips/exception_notification/actions/workflows/ci.yml/badge.svg)](https://github.com/kmcphillips/exception_notification/actions/workflows/ci.yml)
9
5
 
10
6
  ---
11
7
 
12
8
  The Exception Notification gem provides a set of [notifiers](#notifiers) for sending notifications when errors occur in a Rack/Rails application. The built-in notifiers can deliver notifications by [email](docs/notifiers/email.md), [HipChat](docs/notifiers/hipchat.md), [Slack](docs/notifiers/slack.md), [Mattermost](docs/notifiers/mattermost.md), [Teams](docs/notifiers/teams.md), [IRC](docs/notifiers/irc.md), [Amazon SNS](docs/notifiers/sns.md), [Google Chat](docs/notifiers/google_chat.md), [Datadog](docs/notifiers/datadog.md) or via custom [WebHooks](docs/notifiers/webhook.md).
13
9
 
14
- There's a great [Railscast about Exception Notification](http://railscasts.com/episodes/104-exception-notifications-revised) you can see that may help you getting started.
10
+ There's a [Railscast (2011) about Exception Notification](http://railscasts.com/episodes/104-exception-notifications-revised) you can see that may help you getting started.
11
+
12
+
13
+ ## Gem status
14
+
15
+ This gem is not under active development, but is maintained. There are more robust and modern solutions for exception handling. But this code was [extracted from Rails about 15+ years ago](https://github.com/rails/exception_notification) and still has lots of value for some applications.
15
16
 
16
- [Follow us on Twitter](https://twitter.com/exception_notif) to get updates and notices about new releases.
17
17
 
18
18
  ## Requirements
19
19
 
20
- * Ruby 2.5 or greater
21
- * Rails 5.2 or greater, Sinatra or another Rack-based application.
20
+ * Ruby 3.2 or greater
21
+ * If using Rails, version 7.1 or greater. (Sinatra or other Rack-based applications are supported.)
22
+
22
23
 
23
24
  ## Getting Started
24
25
 
25
26
  Add the following line to your application's Gemfile:
26
27
 
27
28
  ```ruby
28
- gem 'exception_notification'
29
+ gem "exception_notification"
29
30
  ```
30
31
 
31
32
  ### Rails
32
33
 
33
34
  In order to install ExceptionNotification as an [engine](https://api.rubyonrails.org/classes/Rails/Engine.html), just run the following command from the terminal:
34
35
 
35
- rails g exception_notification:install
36
+ ```bash
37
+ rails g exception_notification:install
38
+ ```
36
39
 
37
40
  This generates an initializer file, `config/initializers/exception_notification.rb` with some default configuration, which you should modify as needed.
38
41
 
39
42
  Make sure the gem is not listed solely under the `production` group in your `Gemfile`, since this initializer will be loaded regardless of environment. If you want it to only be enabled in production, you can add this to your configuration:
40
43
 
41
44
  ```ruby
42
- config.ignore_if do |exception, options|
43
- not Rails.env.production?
44
- end
45
+ config.ignore_if do |exception, options|
46
+ !!Rails.env.local?
47
+ end
45
48
  ```
46
49
 
47
50
  The generated initializer file will include this require:
48
51
  ```ruby
49
- require 'exception_notification/rails'
52
+ require "exception_notification/rails"
50
53
  ```
51
54
 
52
55
  which automatically adds the ExceptionNotification middleware to the Rails middleware stack. This middleware is what watches for unhandled exceptions from your Rails app (except for [background jobs](#background-jobs)) and notifies you when they occur.
@@ -55,7 +58,7 @@ The generated file adds an `email` notifier:
55
58
 
56
59
  ```ruby
57
60
  config.add_notifier :email, {
58
- email_prefix: '[ERROR] ',
61
+ email_prefix: "[ERROR] ",
59
62
  sender_address: %{"Notifier" <notifier@example.com>},
60
63
  exception_recipients: %w{exceptions@example.com}
61
64
  }
@@ -63,14 +66,15 @@ The generated file adds an `email` notifier:
63
66
 
64
67
  **Note**: In order to enable delivery notifications by email, make sure you have [ActionMailer configured](docs/notifiers/email.md#actionmailer-configuration).
65
68
 
69
+
66
70
  #### Adding middleware manually
67
71
 
68
- Alternatively, if for some reason you don't want to `require 'exception_notification/rails'`, you can manually add the middleware, like this:
72
+ Alternatively, if for some reason you don't want to `require "exception_notification/rails"`, you can manually add the middleware, like this:
69
73
 
70
74
  ```ruby
71
75
  Rails.application.config.middleware.use ExceptionNotification::Rack,
72
76
  email: {
73
- email_prefix: '[PREFIX] ',
77
+ email_prefix: "[PREFIX] ",
74
78
  sender_address: %{"notifier" <notifier@example.com>},
75
79
  exception_recipients: %w{exceptions@example.com}
76
80
  }
@@ -83,7 +87,8 @@ Options passed to the `ExceptionNotification::Rack` middleware in this way are t
83
87
 
84
88
  ### Rack/Sinatra
85
89
 
86
- In order to use ExceptionNotification with Sinatra, please take a look in the [example application](https://github.com/smartinez87/exception_notification/tree/master/examples/sinatra).
90
+ In order to use ExceptionNotification with Sinatra, please take a look in the [example application](examples/sinatra).
91
+
87
92
 
88
93
  ### Custom Data, e.g. Current User
89
94
 
@@ -114,12 +119,23 @@ The current user will show up in your email, in a new section titled "Data".
114
119
  email: "jane.doe@example.com", # etc...
115
120
  ```
116
121
 
117
- For more control over the display of custom data, see "Email notifier ->
118
- Options -> sections" below.
122
+ For more control over the display of custom data, see "Email notifier -> Options -> sections" below.
123
+
124
+
125
+ ### Filtering parameters
126
+
127
+ Since the error notification contains the full request parameters, you may want to filter out sensitive information. The `filter_parameters` in Rails can be used to filter out sensitive information from the request parameters.
128
+
129
+ ```ruby
130
+ config.filter_parameters += [:secret_details, :credit_card_number]
131
+ ```
132
+
133
+ See the Rails documentation for more information: https://guides.rubyonrails.org/configuring.html#config-filter-parameters
134
+
119
135
 
120
136
  ## Notifiers
121
137
 
122
- ExceptionNotification relies on notifiers to deliver notifications when errors occur in your applications. By default, 8 notifiers are available:
138
+ ExceptionNotification relies on notifiers to deliver notifications when errors occur in your applications. By default the following notifiers are available:
123
139
 
124
140
  * [Datadog notifier](docs/notifiers/datadog.md)
125
141
  * [Email notifier](docs/notifiers/email.md)
@@ -132,7 +148,8 @@ ExceptionNotification relies on notifiers to deliver notifications when errors o
132
148
  * [Google Chat notifier](docs/notifiers/google_chat.md)
133
149
  * [WebHook notifier](docs/notifiers/webhook.md)
134
150
 
135
- But, you also can easily implement your own [custom notifier](docs/notifiers/custom.md).
151
+ You also can implement your own [custom notifier](docs/notifiers/custom.md).
152
+
136
153
 
137
154
  ## Error Grouping
138
155
 
@@ -162,6 +179,7 @@ Rails.application.config.middleware.use ExceptionNotification::Rack,
162
179
  # notification_trigger: lambda { |exception, count| count % 10 == 0 }
163
180
  ```
164
181
 
182
+
165
183
  ## Ignore Exceptions
166
184
 
167
185
  You can choose to ignore certain exceptions, which will make ExceptionNotification avoid sending notifications for those specified. There are three ways of specifying which exceptions to ignore:
@@ -177,7 +195,7 @@ You can choose to ignore certain exceptions, which will make ExceptionNotificati
177
195
 
178
196
  ### :ignore_exceptions
179
197
 
180
- *Array of strings, default: %w{ActiveRecord::RecordNotFound Mongoid::Errors::DocumentNotFound AbstractController::ActionNotFound ActionController::RoutingError ActionController::UnknownFormat}*
198
+ *Array of strings, default: %w{ActiveRecord::RecordNotFound Mongoid::Errors::DocumentNotFound AbstractController::ActionNotFound ActionController::RoutingError ActionController::UnknownFormat ActionDispatch::Http::MimeNegotiation::InvalidType Rack::Utils::InvalidParameterError}*
181
199
 
182
200
  Ignore specified exception types. To achieve that, you should use the `:ignore_exceptions` option, like this:
183
201
 
@@ -193,6 +211,7 @@ Rails.application.config.middleware.use ExceptionNotification::Rack,
193
211
 
194
212
  The above will make ExceptionNotifier ignore a *TemplateError* exception, plus the ones ignored by default.
195
213
 
214
+
196
215
  ### :ignore_crawlers
197
216
 
198
217
  *Array of strings, default: []*
@@ -209,6 +228,7 @@ Rails.application.config.middleware.use ExceptionNotification::Rack,
209
228
  }
210
229
  ```
211
230
 
231
+
212
232
  ### :ignore_if
213
233
 
214
234
  *Lambda, default: nil*
@@ -227,6 +247,7 @@ Rails.application.config.middleware.use ExceptionNotification::Rack,
227
247
 
228
248
  You can make use of both the environment and the exception inside the lambda to decide wether to avoid or not sending the notification.
229
249
 
250
+
230
251
  ### :ignore_notifier_if
231
252
 
232
253
  * Hash of Lambda, default: nil*
@@ -253,18 +274,21 @@ Rails.application.config.middleware.use ExceptionNotification::Rack,
253
274
 
254
275
  To customize each condition, you can make use of environment and the exception object inside the lambda.
255
276
 
277
+
256
278
  ## Rack X-Cascade Header
257
279
 
258
280
  Some rack apps (Rails in particular) utilize the "X-Cascade" header to pass the request-handling responsibility to the next middleware in the stack.
259
281
 
260
282
  Rails' routing middleware uses this strategy, rather than raising an exception, to handle routing errors (e.g. 404s); to be notified whenever a 404 occurs, set this option to "false."
261
283
 
284
+
262
285
  ### :ignore_cascade_pass
263
286
 
264
287
  *Boolean, default: true*
265
288
 
266
289
  Set to false to trigger notifications when another rack middleware sets the "X-Cascade" header to "pass."
267
290
 
291
+
268
292
  ## Background Jobs
269
293
 
270
294
  The ExceptionNotification middleware can only detect notifications that occur during web requests (controller actions). If you have any Ruby code that gets run _outside_ of a normal web request (hereafter referred to as a "background job" or "background process"), exceptions must be detected a different way (the middleware won't even be running in this context).
@@ -273,6 +297,7 @@ Examples of background jobs include jobs triggered from a cron file or from a qu
273
297
 
274
298
  ExceptionNotificatior can be configured to automatically notify of exceptions occurring in most common types of Rails background jobs such as [rake tasks](#rake-tasks). Additionally, it provides optional integrations for some 3rd-party libraries such as [Resque and Sidekiq](#resquesidekiq). And of course you can manually trigger a notification if no integration is provided.
275
299
 
300
+
276
301
  ### Rails runner
277
302
 
278
303
  To enable exception notification for your runner commands, add this line to your `config/application.rb` _below_ the `Bundler.require` line (ensuring that `exception_notification` and `rails` gems will have already been required):
@@ -283,6 +308,7 @@ require 'exception_notification/rails'
283
308
 
284
309
  (Requiring it from an initializer is too late, because this depends on the `runner` callback, and that will have already been fired _before_ any initializers run.)
285
310
 
311
+
286
312
  ### Rake tasks
287
313
 
288
314
  If you've already added `require 'exception_notification/rails'` to your `config/application.rb` as described [above](#rails-runner), then there's nothing further you need to do. (That Engine has a `rake_tasks` callback which automatically requires the file below.)
@@ -293,6 +319,7 @@ Alternatively, you can add this line to your `config/initializers/exception_noti
293
319
  require 'exception_notification/rake'
294
320
  ```
295
321
 
322
+
296
323
  ### Manually notify of exceptions
297
324
 
298
325
  If you want to manually send a notifications from a background process that is not _automatically_ handled by ExceptionNotification, then you need to manually call the `notify_exception` method like this:
@@ -322,11 +349,15 @@ end
322
349
 
323
350
  Instead of manually calling background notifications for each job/worker, you can configure ExceptionNotification to do this automatically. For this, run:
324
351
 
325
- rails g exception_notification:install --resque
352
+ ```bash
353
+ rails g exception_notification:install --resque
354
+ ```
326
355
 
327
356
  or
328
357
 
329
- rails g exception_notification:install --sidekiq
358
+ ```bash
359
+ rails g exception_notification:install --sidekiq
360
+ ```
330
361
 
331
362
  As above, make sure the gem is not listed solely under the `production` group, since this initializer will be loaded regardless of environment.
332
363
 
@@ -349,16 +380,19 @@ class SomeController < ApplicationController
349
380
  end
350
381
  ```
351
382
 
352
- ## Support and tickets
383
+ ## Development and support
353
384
 
354
- Here's the list of [issues](https://github.com/smartinez87/exception_notification/issues) we're currently working on.
385
+ Pull requests are very welcome! Issues too.
355
386
 
356
- To contribute, please read first the [Contributing Guide](https://github.com/smartinez87/exception_notification/blob/master/CONTRIBUTING.md).
387
+ You can always debug the gem by running `rake console`.
357
388
 
358
- ## Code of Conduct
389
+ Please read first the [Contributing Guide](CONTRIBUTING.md).
390
+
391
+ And always follow the [code of conduct](CODE_OF_CONDUCT.md).
359
392
 
360
- Everyone interacting in this project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow our [code of conduct](https://github.com/smartinez87/exception_notification/blob/master/CODE_OF_CONDUCT.md).
361
393
 
362
394
  ## License
363
395
 
364
396
  Copyright (c) 2005 Jamis Buck, released under the [MIT license](http://www.opensource.org/licenses/MIT).
397
+
398
+ Maintainer: [Kevin McPhillips](https://github.com/kmcphillips)
data/Rakefile CHANGED
@@ -1,17 +1,24 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'rubygems'
4
- require 'bundler/setup'
3
+ require "rubygems"
4
+ require "bundler/setup"
5
+ require "irb"
5
6
  Bundler::GemHelper.install_tasks
6
- require 'appraisal'
7
7
 
8
- require 'rake/testtask'
8
+ require "rake/testtask"
9
9
 
10
10
  task default: [:test]
11
11
 
12
12
  Rake::TestTask.new(:test) do |t|
13
- t.libs << 'lib'
14
- t.libs << 'test'
15
- t.pattern = 'test/**/*_test.rb'
13
+ t.libs << "lib"
14
+ t.libs << "test"
15
+ t.pattern = "test/**/*_test.rb"
16
16
  t.warning = false
17
17
  end
18
+
19
+ desc "Start a console with the gem"
20
+ task :console do
21
+ ARGV.clear
22
+ puts "ExceptionNotification #{ExceptionNotification::VERSION} loaded."
23
+ IRB.start
24
+ end
@@ -1,42 +1,39 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require File.expand_path('lib/exception_notification/version', __dir__)
3
+ require File.expand_path("lib/exception_notification/version", __dir__)
4
4
 
5
5
  Gem::Specification.new do |s|
6
- s.name = 'exception_notification'
6
+ s.name = "exception_notification"
7
7
  s.version = ExceptionNotification::VERSION
8
- s.authors = ['Jamis Buck', 'Josh Peek']
9
- s.summary = 'Exception notification for Rails apps'
10
- s.homepage = 'https://smartinez87.github.io/exception_notification/'
11
- s.email = 'smartinez87@gmail.com'
12
- s.license = 'MIT'
13
- s.metadata = { 'changelog_uri' => 'https://github.com/smartinez87/exception_notification/blob/master/CHANGELOG.rdoc' }
8
+ s.authors = ["Jamis Buck", "Josh Peek", "Sebastián Martínez", "Kevin McPhillips"]
9
+ s.summary = "Exception notification for Ruby applications"
10
+ s.homepage = "https://kmcphillips.github.io/exception_notification/"
11
+ s.email = "github@kevinmcphillips.ca"
12
+ s.license = "MIT"
13
+ s.metadata = {"changelog_uri" => "https://github.com/kmcphillips/exception_notification/blob/master/CHANGELOG.rdoc"}
14
14
 
15
- s.required_ruby_version = '>= 2.3'
16
- s.required_rubygems_version = '>= 1.8.11'
15
+ s.required_ruby_version = ">= 3.2"
17
16
 
18
17
  s.files = `git ls-files | grep -v '^examples'`.split("\n")
19
18
  s.files -= `git ls-files -- .??*`.split("\n")
20
- s.test_files = `git ls-files -- test`.split("\n")
21
- s.require_path = 'lib'
19
+ s.require_path = "lib"
22
20
 
23
- s.add_dependency('actionmailer', '>= 5.2', '< 9')
24
- s.add_dependency('activesupport', '>= 5.2', '< 9')
21
+ s.add_dependency("actionmailer", ">= 7.1", "< 9")
22
+ s.add_dependency("activesupport", ">= 7.1", "< 9")
25
23
 
26
- s.add_development_dependency 'appraisal', '~> 2.2.0'
27
- s.add_development_dependency 'aws-sdk-sns', '~> 1'
28
- s.add_development_dependency 'carrier-pigeon', '>= 0.7.0'
29
- s.add_development_dependency 'coveralls', '~> 0.8.2'
30
- s.add_development_dependency 'dogapi', '>= 1.23.0'
31
- s.add_development_dependency 'hipchat', '>= 1.0.0'
32
- s.add_development_dependency 'httparty', '~> 0.10.2'
33
- s.add_development_dependency 'mocha', '>= 0.13.0'
34
- s.add_development_dependency 'mock_redis', '~> 0.19.0'
35
- s.add_development_dependency 'net-smtp'
36
- s.add_development_dependency 'rails', '>= 5.2', '< 9'
37
- s.add_development_dependency 'resque', '~> 1.8.0'
38
- s.add_development_dependency 'rubocop'
39
- s.add_development_dependency 'sidekiq', '>= 5.0.4'
40
- s.add_development_dependency 'slack-notifier', '>= 1.0.0'
41
- s.add_development_dependency 'timecop', '~> 0.9.0'
24
+ s.add_development_dependency "aws-sdk-sns", "~> 1"
25
+ s.add_development_dependency "carrier-pigeon", ">= 0.7.0"
26
+ s.add_development_dependency "dogapi", ">= 1.23.0"
27
+ s.add_development_dependency "hipchat", ">= 1.0.0"
28
+ s.add_development_dependency "httparty", "~> 0.10.2"
29
+ s.add_development_dependency "mocha", ">= 0.13.0"
30
+ s.add_development_dependency "mock_redis", "~> 0.19.0"
31
+ s.add_development_dependency "net-smtp"
32
+ s.add_development_dependency "ostruct"
33
+ s.add_development_dependency "rails", ">= 7.1", "< 9"
34
+ s.add_development_dependency "resque", "~> 1.8.0"
35
+ s.add_development_dependency "sidekiq", ">= 5.0.4"
36
+ s.add_development_dependency "slack-notifier", ">= 1.0.0"
37
+ s.add_development_dependency "standard"
38
+ s.add_development_dependency "timecop", "~> 0.9.0"
42
39
  end
@@ -0,0 +1,8 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "rails", "~> 8.0.0"
4
+
5
+ # Include any dependencies here that need to be specifically tested.
6
+ gem "sidekiq", "7.1.0" # >= 7.1.5 for the conditional in sidekiq.rb to check parameter cardinality
7
+
8
+ gemspec path: "../"
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "rails", "~> 7.1.0"
4
+
5
+ gemspec path: "../"