hoodoo 2.2.0 → 2.2.1

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: 27f8a7c4aed490d7d8e01fb68469c393b094e1d83ab1100a700e330c2288e88d
4
- data.tar.gz: ebf5032d0056a507db7bbaf63b51269469350e5e2189b5016d06a1012c88dd7d
3
+ metadata.gz: 74ed5c7f8e4d541e0fa485aa51d93c35e10e010749e372b1d007ade4550f3ce9
4
+ data.tar.gz: 236eca0e1da38dce2e63b529f38d7e3d52d75f4685fbaf81341368721f7d4ac7
5
5
  SHA512:
6
- metadata.gz: 39ffe6dc1b31ff93b3cf5fb6424a253d107d7a9c4c1aeae789d8c04d6e6ebbec06dde7b42f9b411875b55d0722bc6571e9eb3432a148a8ac8b610dc1b96310b2
7
- data.tar.gz: 44a537dcdcf8e7b905a4ac933a2497bd2c14598e2017b63b207baed5fcab4fdd511f17117b5a7a99e27f540f6745c5ade28eac50b4acd50d6354ab8a1c5bf5ee
6
+ metadata.gz: ad755f6aa427b937706e02634b752ec629d6a8ed2c472fb65531eb921d1060d31bbce57a94f20a971a106b681250eb202393135afe9d651f287be47124e5bcca
7
+ data.tar.gz: a8a3452c1c155825b40696dc7b9f943b28976f2d59255977e94d180bda56b767a670beecd8bf309e327a8bb17c014891614665dd5517e8bbdc0d0794803d0275
@@ -57,14 +57,8 @@ module Hoodoo; module Services
57
57
  def report( e, env )
58
58
  opts = { :backtrace => Kernel.caller() }
59
59
  opts[ :rack_env ] = env unless env.nil?
60
- e = sanitize_object(e)
61
- opts = sanitize_object(opts)
62
60
 
63
- # Since an ExceptionReporter is already a "slow communicatory",
64
- # Hoodoo is using threads for behaviour; we don't need the async
65
- # Airbrake mechanism to waste resources doing the same.
66
- #
67
- Airbrake.notify_sync( e, opts )
61
+ send_synchronously_to_airbrake( e, opts )
68
62
  end
69
63
 
70
64
  # Report an exception for errors that occur within a fully handled Rack
@@ -83,36 +77,28 @@ module Hoodoo; module Services
83
77
  :environment_name => Hoodoo::Services::Middleware.environment,
84
78
  :session => user_data_for( context ) || 'unknown'
85
79
  }
86
- e = sanitize_object(e)
87
- opts = sanitize_object(opts)
88
80
 
89
- Airbrake.notify_sync( e, opts )
81
+ send_synchronously_to_airbrake( e, opts )
90
82
  end
91
83
 
92
- private
84
+ private
93
85
 
94
- # Recursive sanitisation method for deeply nested hash objects, returning
95
- # the same object in a non frozen state.
86
+ # Send a report to Airbrake using its synchronous mechanism.
96
87
  #
97
- # Why do I exist?
88
+ # Since an ExceptionReporter is already a "slow communicatory",
89
+ # Hoodoo is using threads for behaviour; we don't need the async
90
+ # Airbrake mechanism to waste resources doing the same.
98
91
  #
99
- # Due to an airbrake-ruby issue where client arguments can be mutated when within a hash,
100
- # a recursive sanitisation process must therefore take place before our inputs are sent
101
- # to Airbrake, ensuring no frozen hash objects are present.
92
+ # +e+:: Exception (or subclass) instance to be reported.
93
+ # +params+:: Parameters for <tt>Airbrake#notify_sync</tt>.
102
94
  #
103
- # https://github.com/airbrake/airbrake-ruby/issues/281
95
+ # http://www.rubydoc.info/gems/airbrake-ruby/Airbrake.notify_sync
96
+ # indicates that the +params+ Hash can contain any data of
97
+ # interest; it will be shown in the Airbrake dashboard.
104
98
  #
105
- def sanitize_object( object )
106
- object = ( object.dup rescue object ) if object.frozen?
107
- return object unless object.is_a?( Hash )
108
-
109
- sanitize_hash( object )
110
- end
111
-
112
- def sanitize_hash( object )
113
- object.each do | key, value |
114
- object[key] = sanitize_object( value )
115
- end
99
+ def send_synchronously_to_airbrake( e, params )
100
+ e = ( e.dup rescue e ) if e.frozen?
101
+ Airbrake.notify_sync( e, params )
116
102
  end
117
103
  end
118
104
 
@@ -12,11 +12,11 @@ module Hoodoo
12
12
  # The Hoodoo gem version. If this changes, be sure to re-run
13
13
  # <tt>bundle install</tt> or <tt>bundle update</tt>.
14
14
  #
15
- VERSION = '2.2.0'
15
+ VERSION = '2.2.1'
16
16
 
17
17
  # The Hoodoo gem date. If this changes, be sure to re-run
18
18
  # <tt>bundle install</tt> or <tt>bundle update</tt>.
19
19
  #
20
- DATE = '2017-11-09'
20
+ DATE = '2017-11-10'
21
21
 
22
22
  end
@@ -96,11 +96,12 @@ describe Hoodoo::Services::Middleware::ExceptionReporting::AirbrakeReporter do
96
96
 
97
97
  it 'can send frozen data large enough to require truncation' do
98
98
  ex = RuntimeError.new( 'A' )
99
- mock_env = { 'rack' => 'request' }
100
-
101
- 1.upto( Airbrake::Notice::PAYLOAD_MAX_SIZE + 10 ) do | i |
102
- mock_env[ Hoodoo::UUID.generate() ] = i
103
- end
99
+ mock_env = {
100
+ 'rack' => 'request',
101
+ 'long' => {
102
+ 'string' => ( '!' * Airbrake::Notice::MAX_NOTICE_SIZE ).freeze
103
+ }.freeze
104
+ }
104
105
 
105
106
  # See previous test (above) for an explanation of the expectations
106
107
  # below.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hoodoo
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Loyalty New Zealand
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-09 00:00:00.000000000 Z
11
+ date: 2017-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dalli
@@ -234,6 +234,20 @@ dependencies:
234
234
  - - "~>"
235
235
  - !ruby/object:Gem::Version
236
236
  version: '2.6'
237
+ - !ruby/object:Gem::Dependency
238
+ name: airbrake-ruby
239
+ requirement: !ruby/object:Gem::Requirement
240
+ requirements:
241
+ - - "~>"
242
+ - !ruby/object:Gem::Version
243
+ version: '2.6'
244
+ type: :development
245
+ prerelease: false
246
+ version_requirements: !ruby/object:Gem::Requirement
247
+ requirements:
248
+ - - "~>"
249
+ - !ruby/object:Gem::Version
250
+ version: '2.6'
237
251
  - !ruby/object:Gem::Dependency
238
252
  name: airbrake
239
253
  requirement: !ruby/object:Gem::Requirement