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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 6aee76b81d1d4742150afdeb95f8a6f544671a3f
4
- data.tar.gz: 4822461573c54709a2d977b82e47de35cecfa51e
2
+ SHA256:
3
+ metadata.gz: ac0b3024c051127bd91c798fe917137f450b3db8ebc315434ecfade3b8775279
4
+ data.tar.gz: 829cd3c05ca289525a789a5b8b93e61a1b996a7a407d91a182f0a126a5a15344
5
5
  SHA512:
6
- metadata.gz: de1c0ab7cb7e7a493ce5f8c8d155ad98450edc891636e2d8e9d82ec2d8bdc312b45ba96f5902e0bc2d70adb35c0e4e20317bbea7d72d54625d7c2764ac2fb374
7
- data.tar.gz: 7546dd2be9a2701d360cdd5fee3ea0e93b9a26e0072c835940659d5244c0e625743924cdde737fee08a7d5f909d03df1752b8e9ae6b8a7d354b62a77d8b89a57
6
+ metadata.gz: a6ff724591f83d687cd332e35b18a9407a97fd99182e7d255ec34e4a0eaed2dd729446df7c8639734d0338c816c12ed4803adf040a1252a0912e8d0c8035d4b2
7
+ data.tar.gz: aac19d62e8bd367eed9bb5dd3e80903161af053410f0ab4a5c251f5115e520ebf3d73d3f86e3789968234f2df2ed69b86454483ff029938854805c733246017e
@@ -0,0 +1 @@
1
+ * @Invoca/octothorpe
@@ -0,0 +1,36 @@
1
+ ---
2
+ name: Pipeline
3
+ on: [push]
4
+ jobs:
5
+ tests:
6
+ name: Unit Tests
7
+ runs-on: ubuntu-latest
8
+ strategy:
9
+ fail-fast: false
10
+ matrix:
11
+ ruby: [2.7, '3.0', 3.1, 3.2, 3.3]
12
+ gemfile:
13
+ - Gemfile
14
+ - gemfiles/rails_5.gemfile
15
+ - gemfiles/rails_6.gemfile
16
+ - gemfiles/rails_7.gemfile
17
+ exclude:
18
+ - gemfile: gemfiles/rails_5.gemfile
19
+ ruby: '3.0'
20
+ - gemfile: gemfiles/rails_5.gemfile
21
+ ruby: 3.1
22
+ - gemfile: gemfiles/rails_5.gemfile
23
+ ruby: 3.2
24
+ - gemfile: gemfiles/rails_5.gemfile
25
+ ruby: 3.3
26
+ env:
27
+ BUNDLE_GEMFILE: ${{ matrix.gemfile }}
28
+ steps:
29
+ - uses: actions/checkout@v2
30
+ - uses: ruby/setup-ruby@v1
31
+ with:
32
+ ruby-version: ${{ matrix.ruby }}
33
+ bundler: 2.3.26
34
+ bundler-cache: true
35
+ - name: Unit tests
36
+ run: bundle exec rspec
data/.gitignore CHANGED
@@ -1,3 +1,6 @@
1
1
  .idea
2
2
  .DS_Store
3
3
  .rubocop-http*
4
+ spec/reports/*
5
+ gemfiles/*.lock
6
+ pkg/
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --require spec_helper
2
+ --format progress
3
+ --color
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.4.2
1
+ 3.1.2
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 3.1.2
data/Appraisals ADDED
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ appraise "rails-5" do
4
+ gem 'activesupport', '~> 5.2'
5
+ end
6
+
7
+ appraise "rails-6" do
8
+ gem 'activesupport', '~> 6.0'
9
+ end
10
+
11
+ appraise "rails-7" do
12
+ gem 'activesupport', '~> 7.0'
13
+ end
data/CHANGELOG.md ADDED
@@ -0,0 +1,150 @@
1
+ # CHANGELOG for `exception_handling`
2
+
3
+ Inspired by [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
4
+
5
+ **Note:** this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [3.0.0] - Unreleased
8
+ ### Added
9
+ - Added explicit testing and support for Ruby 3.2 and 3.3
10
+
11
+ ### Changed
12
+ - Changed `ExceptionHandling.email_environment` configuration to `ExceptionHandling.environment`
13
+
14
+ ### Removed
15
+ - Removed explicit testing of Rails 5
16
+ - Removed all emailing logic from the gem
17
+ - Removed all sensu alerting logic from the gem
18
+ - Removed `Methods` module
19
+ - Removed functionality from `ExceptionHandling.logger=` will implicitly extend the logger with `ContextualLogger::LoggerMixin`
20
+
21
+ ## [2.16.0] - 2023-05-01
22
+ ### Added
23
+ - Add interface for automatically adding honeybadger tags `ExceptionHandling.honeybadger_auto_tagger=`
24
+
25
+ ## [2.15.0] - 2023-03-07
26
+ ### Added
27
+ - Added support for ActionMailer 7.x
28
+ - Added support for ActionPack 7.x
29
+ - Added support for ActiveSupport 7.x
30
+
31
+ ## [2.14.0] - 2023-02-22
32
+ ### Added
33
+ - Added support for plumbing tags through to honeybadger via the `honeybadger_tags` log context parameter
34
+
35
+ ## [2.13.0] - 2022-09-15
36
+ ### Added
37
+ - Added an option for removing the 'exception_handling.' prefix from metric names in ExceptionHandling::default_metric_name
38
+
39
+ ## [2.12.0] - 2022-08-04
40
+ ### Added
41
+ - Support for passing additional Honeybadger configuration parameters
42
+
43
+ ## [2.11.3] - 2022-04-07
44
+ ### Fixed
45
+ - Fixed bug in ruby 2.7+ where `digest` was not required by default
46
+
47
+ ## [2.11.2] - 2022-04-04
48
+ ### Fixed
49
+ - Fixed Ruby 3+ bug where arguments where not being passed using ** operator when writing to the logger
50
+
51
+ ## [2.11.1] - 2022-04-04
52
+ ### Fixed
53
+ - Fixed bug in ruby 3+ where `contextual_logger` was missing ruby 3+ support
54
+
55
+ ## [2.11.0] - 2022-03-29
56
+ ### Added
57
+ - Added support for rails 2.7 and 3+
58
+
59
+ ### Removed
60
+ - Removed support for Rails 4
61
+
62
+ ## [2.10.0] - 2022-03-09
63
+ ### Removed
64
+ - Remove custom object inspection
65
+ This removed Honeybadger-specific callbacks (`lib/exception_handling/honeybadger_callbacks.rb`)
66
+
67
+ ### Deprecated
68
+ - Deprecated use of Honeybadger fork
69
+
70
+ ## [2.9.0] - 2020-03-02
71
+ ### Added
72
+ - Automatically registers with the `escalate` gem's `on_escalate` callback.
73
+
74
+ ## [2.8.1] - 2020-12-01
75
+ ### Added
76
+ - If the `log_context` key `honeybadger_grouping:` is set, pass that value to the `controller:` keyword argument of `HoneyBadger.notify`.
77
+
78
+ ## [2.8.0] - 2020-10-19
79
+ ### Deprecated
80
+ - Deprecated Email Escalation Methods: `escalate_to_production_support`, `escalate_error`, `escalate_warning`, `ensure_escalation`
81
+
82
+ ## [2.7.0] - 2020-10-14
83
+ ### Added
84
+ - Added `LoggingMethods` as a replacement for `Methods` without setting controller or checking for long controller action.
85
+ ### Deprecated
86
+ - Deprecated `Methods` in favor of `LoggingMethods`.
87
+
88
+ ## [2.6.1] - 2020-10-14
89
+ ### Fixed
90
+ - Fixed honeybadger_context_data to always merge `current_context_for_thread`, even if `log_context:` is passed as `nil`.
91
+
92
+ ## [2.6.0] - 2020-08-26
93
+ ### Changed
94
+ - Calling `log_warning` will now log with Severity::WARNING rather than FATAL.
95
+ - Reordered the logging to put the exception class next to the message.
96
+
97
+ ## [2.5.0] - 2020-08-19
98
+ ### Added
99
+ - The `**log_context` passed to `log_error`/`log_warning`/`log_info` is now
100
+ passed into `Honeybadger.notify()`, in `context: { log_context: ... }`.
101
+
102
+ ### Fixed
103
+ - Silenced test warning noise by no longer running ruby -w.
104
+ - Renamed a constant to ALLOWLIST.
105
+
106
+ ## [2.4.4] - 2020-08-10
107
+ ### Fixed
108
+ - `ExceptionHandling.logger = nil` no longer displays an "implicit extend" deprecation warning.
109
+
110
+ ## [2.4.3] - 2020-05-14
111
+ ### Deprecated
112
+ - In `ExceptionHandling.logger=`, implicit `logger.extend ContextualLogger::LoggerMixin` is now deprecated.
113
+ This will be removed in version 3.0 and an `ArgumentError` will be raised if the logger
114
+ doesn't have that mixin. Instead of this implicit behavior, you should explicitly either `extend`
115
+ your logger instance or `include` that mixin into your `Logger` class.
116
+
117
+ ## [2.4.2] - 2020-05-11
118
+ ### Added
119
+ - Added support for rails 5 and 6.
120
+ - Added appraisal tests for all supported rails version: 4/5/6
121
+
122
+ ### Changed
123
+ - Updated various test to be compatible with rails version 4/5/6
124
+ - Updated the CI pipeline to test against all three supported versions of rails
125
+
126
+ ## [2.4.1] - 2020-04-29
127
+ ### Changed
128
+ - No longer depends on hobo_support. Uses invoca-utils 0.3 instead.
129
+
130
+ [2.16.0]: https://github.com/Invoca/exception_handling/compare/v2.15.0...v2.16.0
131
+ [2.15.0]: https://github.com/Invoca/exception_handling/compare/v2.14.0...v2.15.0
132
+ [2.14.0]: https://github.com/Invoca/exception_handling/compare/v2.13.0...v2.14.0
133
+ [2.13.0]: https://github.com/Invoca/exception_handling/compare/v2.12.0...v2.13.0
134
+ [2.12.0]: https://github.com/Invoca/exception_handling/compare/v2.11.3...v2.12.0
135
+ [2.11.3]: https://github.com/Invoca/exception_handling/compare/v2.11.2...v2.11.3
136
+ [2.11.2]: https://github.com/Invoca/exception_handling/compare/v2.11.1...v2.11.2
137
+ [2.11.1]: https://github.com/Invoca/exception_handling/compare/v2.11.0...v2.11.1
138
+ [2.11.0]: https://github.com/Invoca/exception_handling/compare/v2.10.0...v2.11.0
139
+ [2.10.0]: https://github.com/Invoca/exception_handling/compare/v2.9.0...v2.10.0
140
+ [2.9.0]: https://github.com/Invoca/exception_handling/compare/v2.8.1...v2.9.0
141
+ [2.8.1]: https://github.com/Invoca/exception_handling/compare/v2.8.0...v2.8.1
142
+ [2.8.0]: https://github.com/Invoca/exception_handling/compare/v2.7.0...v2.8.0
143
+ [2.7.0]: https://github.com/Invoca/exception_handling/compare/v2.6.1...v2.7.0
144
+ [2.6.1]: https://github.com/Invoca/exception_handling/compare/v2.6.0...v2.6.1
145
+ [2.6.0]: https://github.com/Invoca/exception_handling/compare/v2.5.0...v2.6.0
146
+ [2.5.0]: https://github.com/Invoca/exception_handling/compare/v2.4.4...v2.5.0
147
+ [2.4.4]: https://github.com/Invoca/exception_handling/compare/v2.4.3...v2.4.4
148
+ [2.4.3]: https://github.com/Invoca/exception_handling/compare/v2.4.2...v2.4.3
149
+ [2.4.2]: https://github.com/Invoca/exception_handling/compare/v2.4.1...v2.4.2
150
+ [2.4.1]: https://github.com/Invoca/exception_handling/compare/v2.4.0...v2.4.1
data/Gemfile CHANGED
@@ -2,21 +2,15 @@
2
2
 
3
3
  source 'https://rubygems.org'
4
4
 
5
- # Specify your gem's dependencies in attr_default.gemspec
6
5
  gemspec
7
6
 
8
- gem 'actionmailer', '>= 4.2.11.1'
9
- gem 'actionpack', '>= 4.2.11.1'
10
- gem 'activesupport', '>= 4.2.11.1'
11
-
12
- group :development do
13
- gem 'pry'
14
- gem 'rake', '>=0.9'
15
- gem 'rr'
16
- gem 'rubocop'
17
- gem 'shoulda', '> 3.1.1'
18
- end
19
-
20
- group :test do
21
- gem 'honeybadger', '3.3.1-1', git: 'git@github.com:Invoca/honeybadger-ruby', ref: 'bb5f2b8a86e4147c38a6270d39ad610fab4dd5e6'
22
- end
7
+ gem 'activesupport'
8
+ gem 'appraisal', '~> 2.2'
9
+ gem 'honeybadger', '~> 4.11'
10
+ gem 'pry'
11
+ gem 'pry-byebug'
12
+ gem 'rake'
13
+ gem 'rspec'
14
+ gem 'rspec_junit_formatter'
15
+ gem 'rubocop'
16
+ gem 'test-unit'
data/Gemfile.lock CHANGED
@@ -1,126 +1,72 @@
1
- GIT
2
- remote: git@github.com:Invoca/honeybadger-ruby
3
- revision: bb5f2b8a86e4147c38a6270d39ad610fab4dd5e6
4
- ref: bb5f2b8a86e4147c38a6270d39ad610fab4dd5e6
5
- specs:
6
- honeybadger (3.3.1.pre.1)
7
-
8
1
  PATH
9
2
  remote: .
10
3
  specs:
11
- exception_handling (3.0.pre.1)
12
- actionmailer (~> 4.2)
13
- actionpack (~> 4.2)
14
- activesupport (~> 4.2)
15
- contextual_logger
16
- eventmachine (~> 1.0)
17
- hobo_support
18
- invoca-utils (~> 0.0)
4
+ exception_handling (3.0.0.pre.2)
5
+ activesupport (>= 5.2)
6
+ contextual_logger (~> 1.0)
7
+ escalate (~> 0.3)
8
+ invoca-utils (~> 0.3)
9
+ psych (~> 3.0)
19
10
 
20
11
  GEM
21
12
  remote: https://rubygems.org/
22
13
  specs:
23
- actionmailer (4.2.11.1)
24
- actionpack (= 4.2.11.1)
25
- actionview (= 4.2.11.1)
26
- activejob (= 4.2.11.1)
27
- mail (~> 2.5, >= 2.5.4)
28
- rails-dom-testing (~> 1.0, >= 1.0.5)
29
- actionpack (4.2.11.1)
30
- actionview (= 4.2.11.1)
31
- activesupport (= 4.2.11.1)
32
- rack (~> 1.6)
33
- rack-test (~> 0.6.2)
34
- rails-dom-testing (~> 1.0, >= 1.0.5)
35
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
36
- actionview (4.2.11.1)
37
- activesupport (= 4.2.11.1)
38
- builder (~> 3.1)
39
- erubis (~> 2.7.0)
40
- rails-dom-testing (~> 1.0, >= 1.0.5)
41
- rails-html-sanitizer (~> 1.0, >= 1.0.3)
42
- activejob (4.2.11.1)
43
- activesupport (= 4.2.11.1)
44
- globalid (>= 0.3.0)
45
- activemodel (4.2.11.1)
46
- activesupport (= 4.2.11.1)
47
- builder (~> 3.1)
48
- activerecord (4.2.11.1)
49
- activemodel (= 4.2.11.1)
50
- activesupport (= 4.2.11.1)
51
- arel (~> 6.0)
52
- activesupport (4.2.11.1)
53
- i18n (~> 0.7)
14
+ activesupport (6.0.4.7)
15
+ concurrent-ruby (~> 1.0, >= 1.0.2)
16
+ i18n (>= 0.7, < 2)
54
17
  minitest (~> 5.1)
55
- thread_safe (~> 0.3, >= 0.3.4)
56
18
  tzinfo (~> 1.1)
57
- arel (6.0.4)
19
+ zeitwerk (~> 2.2, >= 2.2.2)
20
+ appraisal (2.2.0)
21
+ bundler
22
+ rake
23
+ thor (>= 0.14.0)
58
24
  ast (2.4.0)
59
- builder (3.2.3)
60
- coderay (1.1.2)
61
- concurrent-ruby (1.1.5)
62
- contextual_logger (0.3.1)
63
- activesupport
25
+ byebug (11.1.3)
26
+ coderay (1.1.3)
27
+ concurrent-ruby (1.1.10)
28
+ contextual_logger (1.3.0)
29
+ activesupport (< 7.1)
64
30
  json
65
- crass (1.0.4)
66
- erubis (2.7.0)
67
- eventmachine (1.2.7)
68
- globalid (0.4.2)
69
- activesupport (>= 4.2.0)
70
- hobo_support (2.2.6)
71
- rails (~> 4.2.6)
72
- i18n (0.9.5)
31
+ diff-lcs (1.5.0)
32
+ escalate (0.3.0)
33
+ honeybadger (4.11.0)
34
+ i18n (1.10.0)
73
35
  concurrent-ruby (~> 1.0)
74
- invoca-utils (0.0.5)
36
+ invoca-utils (0.5.1)
37
+ activesupport (>= 5.0)
75
38
  jaro_winkler (1.5.3)
76
- json (2.3.0)
77
- loofah (2.2.3)
78
- crass (~> 1.0.2)
79
- nokogiri (>= 1.5.9)
80
- mail (2.7.1)
81
- mini_mime (>= 0.1.1)
82
- method_source (0.9.2)
83
- mini_mime (1.0.1)
84
- mini_portile2 (2.4.0)
85
- minitest (5.11.3)
86
- nokogiri (1.10.4)
87
- mini_portile2 (~> 2.4.0)
39
+ json (2.7.1)
40
+ method_source (1.0.0)
41
+ minitest (5.15.0)
88
42
  parallel (1.17.0)
89
43
  parser (2.6.3.0)
90
44
  ast (~> 2.4.0)
91
- pry (0.12.2)
92
- coderay (~> 1.1.0)
93
- method_source (~> 0.9.0)
94
- rack (1.6.11)
95
- rack-test (0.6.3)
96
- rack (>= 1.0)
97
- rails (4.2.11.1)
98
- actionmailer (= 4.2.11.1)
99
- actionpack (= 4.2.11.1)
100
- actionview (= 4.2.11.1)
101
- activejob (= 4.2.11.1)
102
- activemodel (= 4.2.11.1)
103
- activerecord (= 4.2.11.1)
104
- activesupport (= 4.2.11.1)
105
- bundler (>= 1.3.0, < 2.0)
106
- railties (= 4.2.11.1)
107
- sprockets-rails
108
- rails-deprecated_sanitizer (1.0.3)
109
- activesupport (>= 4.2.0.alpha)
110
- rails-dom-testing (1.0.9)
111
- activesupport (>= 4.2.0, < 5.0)
112
- nokogiri (~> 1.6)
113
- rails-deprecated_sanitizer (>= 1.0.1)
114
- rails-html-sanitizer (1.0.4)
115
- loofah (~> 2.2, >= 2.2.2)
116
- railties (4.2.11.1)
117
- actionpack (= 4.2.11.1)
118
- activesupport (= 4.2.11.1)
119
- rake (>= 0.8.7)
120
- thor (>= 0.18.1, < 2.0)
45
+ power_assert (1.2.0)
46
+ pry (0.14.2)
47
+ coderay (~> 1.1)
48
+ method_source (~> 1.0)
49
+ pry-byebug (3.8.0)
50
+ byebug (~> 11.0)
51
+ pry (~> 0.10)
52
+ psych (3.3.4)
121
53
  rainbow (3.0.0)
122
- rake (12.3.2)
123
- rr (1.2.1)
54
+ rake (13.0.1)
55
+ rspec (3.9.0)
56
+ rspec-core (~> 3.9.0)
57
+ rspec-expectations (~> 3.9.0)
58
+ rspec-mocks (~> 3.9.0)
59
+ rspec-core (3.9.2)
60
+ rspec-support (~> 3.9.3)
61
+ rspec-expectations (3.9.2)
62
+ diff-lcs (>= 1.2.0, < 2.0)
63
+ rspec-support (~> 3.9.0)
64
+ rspec-mocks (3.9.1)
65
+ diff-lcs (>= 1.2.0, < 2.0)
66
+ rspec-support (~> 3.9.0)
67
+ rspec-support (3.9.4)
68
+ rspec_junit_formatter (0.4.1)
69
+ rspec-core (>= 2, < 4, != 2.12.0)
124
70
  rubocop (0.74.0)
125
71
  jaro_winkler (~> 1.5.1)
126
72
  parallel (~> 1.10)
@@ -129,39 +75,30 @@ GEM
129
75
  ruby-progressbar (~> 1.7)
130
76
  unicode-display_width (>= 1.4.0, < 1.7)
131
77
  ruby-progressbar (1.10.1)
132
- shoulda (3.6.0)
133
- shoulda-context (~> 1.0, >= 1.0.1)
134
- shoulda-matchers (~> 3.0)
135
- shoulda-context (1.2.2)
136
- shoulda-matchers (3.1.3)
137
- activesupport (>= 4.0.0)
138
- sprockets (3.7.2)
139
- concurrent-ruby (~> 1.0)
140
- rack (> 1, < 3)
141
- sprockets-rails (3.2.1)
142
- actionpack (>= 4.0)
143
- activesupport (>= 4.0)
144
- sprockets (>= 3.0.0)
78
+ test-unit (3.3.6)
79
+ power_assert
145
80
  thor (1.0.1)
146
81
  thread_safe (0.3.6)
147
- tzinfo (1.2.5)
82
+ tzinfo (1.2.9)
148
83
  thread_safe (~> 0.1)
149
84
  unicode-display_width (1.6.0)
85
+ zeitwerk (2.5.4)
150
86
 
151
87
  PLATFORMS
152
88
  ruby
153
89
 
154
90
  DEPENDENCIES
155
- actionmailer (>= 4.2.11.1)
156
- actionpack (>= 4.2.11.1)
157
- activesupport (>= 4.2.11.1)
91
+ activesupport
92
+ appraisal (~> 2.2)
158
93
  exception_handling!
159
- honeybadger (= 3.3.1.pre.1)!
94
+ honeybadger (~> 4.11)
160
95
  pry
161
- rake (>= 0.9)
162
- rr
96
+ pry-byebug
97
+ rake
98
+ rspec
99
+ rspec_junit_formatter
163
100
  rubocop
164
- shoulda (> 3.1.1)
101
+ test-unit
165
102
 
166
103
  BUNDLED WITH
167
- 1.17.2
104
+ 2.3.22
data/README.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  Enable emails for your exceptions that occur in your application!
4
4
 
5
+ ## Dependencies
6
+ - Ruby 2.6
7
+ - Rails >= 4.2, < 7
8
+
5
9
  ## Installation
6
10
 
7
11
  Add this line to your application's Gemfile:
@@ -21,24 +25,18 @@ Or install it yourself as:
21
25
  Add some code to initialize the settings in your application.
22
26
  For example:
23
27
 
24
- require "exception_handling"
25
-
26
- # required
27
- ExceptionHandling.server_name = Cluster['server_name']
28
- ExceptionHandling.sender_address = %("Exceptions" <exceptions@example.com>)
29
- ExceptionHandling.exception_recipients = ['exceptions@example.com']
30
- ExceptionHandling.logger = Rails.logger
28
+ ```ruby
29
+ require "exception_handling"
31
30
 
32
- # optional
33
- ExceptionHandling.escalation_recipients = ['escalation@example.com']
34
- ExceptionHandling.filter_list_filename = "#{Rails.root}/config/exception_filters.yml"
35
- ExceptionHandling.email_environment = Rails.env
36
- ExceptionHandling.eventmachine_safe = false
37
- ExceptionHandling.eventmachine_synchrony = false
38
- ExceptionHandling.sensu_host = "127.0.0.1"
39
- ExceptionHandling.sensu_port = 3030
40
- ExceptionHandling.sensu_prefix = ""
31
+ # required
32
+ ExceptionHandling.server_name = Cluster['server_name']
33
+ ExceptionHandling.logger = Rails.logger
41
34
 
35
+ # optional
36
+ ExceptionHandling.filter_list_filename = "#{Rails.root}/config/exception_filters.yml"
37
+ ExceptionHandling.environment = Rails.env
38
+ ExceptionHandling.honeybadger_auto_tagger = ->(exception) { [] } # See "Automatically Tagging Exceptions" section below for examples
39
+ ```
42
40
 
43
41
  ## Usage
44
42
 
@@ -58,6 +56,40 @@ Then call any method available in the `ExceptionHandling::Methods` mixin:
58
56
  flash.now['error'] = "A specific error occurred. Support has been notified."
59
57
  end
60
58
 
59
+ ### Tagging Exceptions in Honeybadger
60
+
61
+ ⚠️ Honeybadger differentiates tags by spaces and/or commas, so you should **not** include spaces or commas in your tags.
62
+
63
+ ⚠️ Tags are case-sensitive.
64
+
65
+ #### Manually Tagging Exceptions
66
+
67
+ Add `:honeybadger_tags` to your `log_context` usage with an array of strings.
68
+
69
+ ```ruby
70
+ log_error(ex, "A specific error occurred.", honeybadger_tags: ["critical", "sequoia"])
71
+ ```
72
+
73
+ **Note**: Manual tags will be merged with any automatic tags.
74
+
75
+ #### Automatically Tagging Exceptions (`honeybadger_auto_tagger=`)
76
+
77
+ Configure exception handling so that you can automatically apply multiple tags to exceptions sent to honeybadger.
78
+
79
+ The Proc must accept an `exception` argument that will be the exception in question and must always return an array of strings (the array can be empty).
80
+
81
+ Example to enable auto-tagging:
82
+ ```ruby
83
+ ExceptionHandling.honeybadger_auto_tagger = ->(exception) do
84
+ exception.message.match?(/fire/) ? ["high-urgency", "danger"] : ["low-urgency"]
85
+ end
86
+ ```
87
+
88
+ Example to disable auto-tagging:
89
+ ```ruby
90
+ ExceptionHandling.honeybadger_auto_tagger = nil
91
+ ```
92
+
61
93
  ## Custom Hooks
62
94
 
63
95
  ### custom_data_hook
@@ -89,15 +121,15 @@ There is another hook available intended for custom actions after an error email
89
121
  else
90
122
  Invoca::Metrics::Client.metrics.counter("exception_handling/exception")
91
123
  end
92
-
124
+
93
125
  case honeybadger_status
94
126
  when :success
95
127
  Invoca::Metrics::Client.metrics.counter("exception_handling.honeybadger.success")
96
- when :failure
128
+ when :failure
97
129
  Invoca::Metrics::Client.metrics.counter("exception_handling.honeybadger.failure")
98
130
  when :skipped
99
131
  Invoca::Metrics::Client.metrics.counter("exception_handling.honeybadger.skipped")
100
- end
132
+ end
101
133
  end
102
134
  ExceptionHandling.post_log_error_hook = method(:log_error_metrics)
103
135
 
data/Rakefile CHANGED
@@ -1,18 +1,15 @@
1
1
  #!/usr/bin/env rake
2
2
  # frozen_string_literal: true
3
3
 
4
- require "bundler/gem_tasks"
5
4
  require 'rake/testtask'
5
+ require "bundler/gem_tasks"
6
+
7
+ require_relative 'spec/rake_test_warning_false'
6
8
 
7
- namespace :test do
8
- Rake::TestTask.new do |t|
9
- t.name = :unit
10
- t.libs << "test"
11
- t.pattern = 'test/unit/**/*_test.rb'
12
- t.verbose = true
13
- end
14
- Rake::Task['test:unit'].comment = "Run the unit tests"
9
+ desc "run rspec unit tests"
10
+ begin
11
+ require 'rspec/core/rake_task'
12
+ RSpec::Core::RakeTask.new(:rspec)
15
13
  end
16
14
 
17
- task test: 'test:unit'
18
- task default: 'test'
15
+ task default: :rspec
@@ -3,28 +3,26 @@
3
3
  require File.expand_path('lib/exception_handling/version', __dir__)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
- spec.authors = ["Colin Kelley"]
7
- spec.email = ["colindkelley@gmail.com"]
8
- spec.description = 'Exception handling logger/emailer'
9
- spec.summary = "Invoca's exception handling logger/emailer layer, based on exception_notifier. Works with Rails or EventMachine or EventMachine+Synchrony."
6
+ spec.authors = ["Invoca"]
7
+ spec.email = ["development@invoca.com"]
8
+ spec.description = 'Exception handling logger'
9
+ spec.summary = "Invoca's exception handling logger layer, based on exception_notifier."
10
10
  spec.homepage = "https://github.com/Invoca/exception_handling"
11
11
 
12
- spec.files = `git ls-files`.split($OUTPUT_RECORD_SEPARATOR)
12
+ spec.files = `git ls-files`.split("\n")
13
13
  spec.executables = spec.files.grep(%r{^bin/}).map { |f| File.basename(f) }
14
14
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/.*\.rb})
15
15
  spec.name = "exception_handling"
16
16
  spec.require_paths = ["lib"]
17
17
  spec.version = ExceptionHandling::VERSION
18
- spec.metadata = {
18
+ spec.metadata = {
19
19
  "source_code_uri" => "https://github.com/Invoca/exception_handling",
20
20
  "allowed_push_host" => "https://rubygems.org"
21
21
  }
22
22
 
23
- spec.add_dependency 'actionmailer', '~> 4.2'
24
- spec.add_dependency 'actionpack', '~> 4.2'
25
- spec.add_dependency 'activesupport', '~> 4.2'
26
- spec.add_dependency 'contextual_logger'
27
- spec.add_dependency 'eventmachine', '~> 1.0'
28
- spec.add_dependency 'hobo_support'
29
- spec.add_dependency 'invoca-utils', '~> 0.0'
23
+ spec.add_dependency 'activesupport', '>= 5.2'
24
+ spec.add_dependency 'contextual_logger', '~> 1.0'
25
+ spec.add_dependency 'escalate', '~> 0.3'
26
+ spec.add_dependency 'invoca-utils', '~> 0.3'
27
+ spec.add_dependency 'psych', '~> 3.0'
30
28
  end