honeybadger 5.8.0 → 5.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 93eae2a3397ecc7b7bc1b86b2a09436cc41e80d6143aa813175aafbc4ef81d64
4
- data.tar.gz: f2f9025c4fd6f7afc092ba4ce12cf22f0815bea6b0d32e6566f95c52c98be8b9
3
+ metadata.gz: 6d9f929f3c5aabe854d9c6cd222a6863e751f18784077580cc8781714f0e61e6
4
+ data.tar.gz: cc4c3921b06bcf5c0fee59a5d0a33b1359da5b255db1e3709bf08cf0f84731a7
5
5
  SHA512:
6
- metadata.gz: ebda94d56e7c4062d3daab6d7ee19828d8a183a7d6caa33a7bef18fcc091bf1cc0b3b60708a50d0da978ec3411d6a27532bb559fb117302312d5c83f5cac4eeb
7
- data.tar.gz: d693bae2da5c6434df5ce6b0c1ab885f8f89390c0c9849e16a4a0e937685426f18be24947ff52e1f5b8176b9395262315d67b3500e6323e2211c3bc30743d7c4
6
+ metadata.gz: b786d75e0588efb1cec01e13fbb46ecd1d71d305f21b20cf41e836f88ffac2e10a938d058e0be62d41211e2c4476b210c25793919d3470a0f2aa07b2391e2fec
7
+ data.tar.gz: 68faad897df72b3ac7efa6a7321c00c5d71c97578431a39ba84d87ce8f828bea86ee754fd1216dceb2d01ac00a5b434072e2a706180da6d676777e443c28f5e4
data/CHANGELOG.md CHANGED
@@ -1,6 +1,27 @@
1
1
  # Change Log
2
2
 
3
3
 
4
+ ## [5.10.0](https://github.com/honeybadger-io/honeybadger-ruby/compare/v5.9.0...v5.10.0) (2024-05-10)
5
+
6
+
7
+ ### Features
8
+
9
+ * return block value if block was passed to Honeybadger.context ([#546](https://github.com/honeybadger-io/honeybadger-ruby/issues/546)) ([2d7c685](https://github.com/honeybadger-io/honeybadger-ruby/commit/2d7c68565a5b9013fbbad6da16a706f38a3306b0))
10
+
11
+ ## [5.9.0](https://github.com/honeybadger-io/honeybadger-ruby/compare/v5.8.1...v5.9.0) (2024-05-09)
12
+
13
+
14
+ ### Features
15
+
16
+ * implement local contexts ([#541](https://github.com/honeybadger-io/honeybadger-ruby/issues/541)) ([806718e](https://github.com/honeybadger-io/honeybadger-ruby/commit/806718e76bf8d132a632c75bea124a8b22a4cc97))
17
+
18
+ ## [5.8.1](https://github.com/honeybadger-io/honeybadger-ruby/compare/v5.8.0...v5.8.1) (2024-05-07)
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * store pr title before usage ([#542](https://github.com/honeybadger-io/honeybadger-ruby/issues/542)) ([d4cdfe7](https://github.com/honeybadger-io/honeybadger-ruby/commit/d4cdfe71d6a957be8c61bcb5c01f96b0735b5c97))
24
+
4
25
  ## [5.8.0](https://github.com/honeybadger-io/honeybadger-ruby/compare/v5.7.0...v5.8.0) (2024-03-23)
5
26
 
6
27
 
@@ -258,9 +258,11 @@ module Honeybadger
258
258
  # When present, tags will be applied to errors with this context
259
259
  # (optional).
260
260
  #
261
- # @return [self] so that method calls can be chained.
262
- def context(context = nil)
263
- context_manager.set_context(context) unless context.nil?
261
+ # @return [Object, self] value of the block if passed, otherwise self
262
+ def context(context = nil, &block)
263
+ block_result = context_manager.set_context(context, &block) unless context.nil?
264
+ return block_result if block_given?
265
+
264
266
  self
265
267
  end
266
268
 
@@ -59,7 +59,7 @@ MSG
59
59
  api_key: config.get(:api_key),
60
60
  notifier: NOTIFIER,
61
61
  error: {
62
- class: 'honeybdager exec error',
62
+ class: 'honeybadger exec error',
63
63
  message: result.msg
64
64
  },
65
65
  request: {
@@ -21,15 +21,36 @@ module Honeybadger
21
21
  # Internal helpers
22
22
 
23
23
 
24
- def set_context(hash)
24
+ def set_context(hash, &block)
25
+ local = block_given?
25
26
  @mutex.synchronize do
26
- @context ||= {}
27
- @context.update(Context(hash))
27
+ @global_context ||= {}
28
+ @local_context ||= []
29
+
30
+ new_context = Context(hash)
31
+
32
+ if local
33
+ @local_context << new_context
34
+ else
35
+ @global_context.update(new_context)
36
+ end
37
+ end
38
+
39
+ if local
40
+ begin
41
+ yield
42
+ ensure
43
+ @mutex.synchronize { @local_context&.pop }
44
+ end
28
45
  end
29
46
  end
30
47
 
31
48
  def get_context
32
- @mutex.synchronize { @context }
49
+ @mutex.synchronize do
50
+ return @global_context unless @local_context
51
+
52
+ @global_context.merge(@local_context.inject({}, :merge))
53
+ end
33
54
  end
34
55
 
35
56
  def set_rack_env(env)
@@ -46,10 +67,10 @@ module Honeybadger
46
67
 
47
68
  def _initialize
48
69
  @mutex.synchronize do
49
- @context = nil
70
+ @global_context = nil
71
+ @local_context = nil
50
72
  @rack_env = nil
51
73
  end
52
74
  end
53
-
54
75
  end
55
76
  end
@@ -1,4 +1,4 @@
1
1
  module Honeybadger
2
2
  # The current String Honeybadger version.
3
- VERSION = '5.8.0'.freeze
3
+ VERSION = '5.10.0'.freeze
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: honeybadger
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.8.0
4
+ version: 5.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Honeybadger Industries LLC
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-23 00:00:00.000000000 Z
11
+ date: 2024-05-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Make managing application errors a more pleasant experience.
14
14
  email:
@@ -144,7 +144,7 @@ metadata:
144
144
  documentation_uri: https://docs.honeybadger.io/lib/ruby/
145
145
  homepage_uri: https://www.honeybadger.io/for/ruby/
146
146
  source_code_uri: https://github.com/honeybadger-io/honeybadger-ruby
147
- post_install_message:
147
+ post_install_message:
148
148
  rdoc_options:
149
149
  - "--markup=tomdoc"
150
150
  - "--main=README.md"
@@ -163,7 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
163
163
  version: '0'
164
164
  requirements: []
165
165
  rubygems_version: 3.5.3
166
- signing_key:
166
+ signing_key:
167
167
  specification_version: 4
168
168
  summary: Error reports you can be happy about.
169
169
  test_files: []