airbrake-ruby 1.2.4 → 1.3.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.
- checksums.yaml +4 -4
- data/lib/airbrake-ruby.rb +9 -13
- data/lib/airbrake-ruby/async_sender.rb +2 -1
- data/lib/airbrake-ruby/notice.rb +5 -2
- data/lib/airbrake-ruby/version.rb +1 -1
- data/spec/airbrake_spec.rb +13 -14
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dec071c8c6dc94827a5094f345a3e04f6e14d403
|
4
|
+
data.tar.gz: f70b0927dcb8a948890cbe1f08f440dbffa832ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23da1628abcb6f3db15af6988c346f102ebda373ee6ac30212981680cd76014de7c15cdf4e877e81ef7f6fbd7e7996f5c07501cf1472c4c9b9cb8f9e4be22a6d
|
7
|
+
data.tar.gz: 5df62237f843c6521677c6e8f5ceb98547ef76d8931334fb6e611ca489dcb7337cb03044cad51d76375a4339ab426b750a5dd63e2d6addeda80c3f7cb1e0dc31
|
data/lib/airbrake-ruby.rb
CHANGED
@@ -98,7 +98,7 @@ module Airbrake
|
|
98
98
|
def configure(notifier = :default)
|
99
99
|
yield config = Airbrake::Config.new
|
100
100
|
|
101
|
-
if
|
101
|
+
if configured?(notifier)
|
102
102
|
raise Airbrake::Error,
|
103
103
|
"the '#{notifier}' notifier was already configured"
|
104
104
|
else
|
@@ -266,6 +266,7 @@ module Airbrake
|
|
266
266
|
# @option deploy_params [Symbol] :repository
|
267
267
|
# @option deploy_params [Symbol] :revision
|
268
268
|
# @option deploy_params [Symbol] :version
|
269
|
+
# @return [void]
|
269
270
|
# @since v5.0.0
|
270
271
|
# @api private
|
271
272
|
def create_deploy(deploy_params, notifier = :default)
|
@@ -275,20 +276,15 @@ module Airbrake
|
|
275
276
|
private
|
276
277
|
|
277
278
|
##
|
278
|
-
# Calls +method+ on +notifier+ with provided +args+.
|
279
|
-
#
|
280
|
-
# @raise [Airbrake::Error] if none of the notifiers exist
|
279
|
+
# Calls +method+ on +notifier+ with provided +args+. If +notifier+ is not
|
280
|
+
# configured, returns nil.
|
281
281
|
def call_notifier(notifier, method, *args, &block)
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
# If we raise SystemExit, the Ruby process can gracefully quit without
|
286
|
-
# the unwanted Airbrake::Error.
|
287
|
-
raise args.first if args.first.class == SystemExit
|
282
|
+
return unless configured?(notifier)
|
283
|
+
@notifiers[notifier].__send__(method, *args, &block)
|
284
|
+
end
|
288
285
|
|
289
|
-
|
290
|
-
|
291
|
-
end
|
286
|
+
def configured?(notifier)
|
287
|
+
@notifiers.key?(notifier)
|
292
288
|
end
|
293
289
|
end
|
294
290
|
end
|
@@ -114,7 +114,8 @@ module Airbrake
|
|
114
114
|
"#{LOG_LABEL} AsyncSender has reached its capacity of " \
|
115
115
|
"#{@unsent.max} and the following notice will not be delivered " \
|
116
116
|
"Error: #{notice[:errors][0][:type]} - #{notice[:errors][0][:message]}\n" \
|
117
|
-
"Backtrace: \n" + backtrace.join("\n")
|
117
|
+
"Backtrace: \n" + backtrace.join("\n")
|
118
|
+
)
|
118
119
|
nil
|
119
120
|
end
|
120
121
|
end
|
data/lib/airbrake-ruby/notice.rb
CHANGED
@@ -140,7 +140,8 @@ module Airbrake
|
|
140
140
|
private
|
141
141
|
|
142
142
|
def context(params)
|
143
|
-
|
143
|
+
ctx = {
|
144
|
+
version: @config.app_version,
|
144
145
|
# We ensure that root_directory is always a String, so it can always be
|
145
146
|
# converted to JSON in a predictable manner (when it's a Pathname and in
|
146
147
|
# Rails environment, it converts to unexpected JSON).
|
@@ -153,7 +154,9 @@ module Airbrake
|
|
153
154
|
|
154
155
|
# Make sure we always send hostname.
|
155
156
|
hostname: HOSTNAME
|
156
|
-
}
|
157
|
+
}
|
158
|
+
|
159
|
+
ctx.merge(CONTEXT).delete_if { |_key, val| val.nil? || val.empty? }
|
157
160
|
end
|
158
161
|
|
159
162
|
def raise_if_ignored
|
data/spec/airbrake_spec.rb
CHANGED
@@ -20,18 +20,15 @@ RSpec.describe Airbrake do
|
|
20
20
|
described_class.instance_variable_set(:@notifiers, {})
|
21
21
|
end
|
22
22
|
|
23
|
-
shared_examples '
|
24
|
-
it "
|
23
|
+
shared_examples 'non-configured notifier handling' do |method|
|
24
|
+
it "returns nil if there is no configured notifier when using #{method}" do
|
25
25
|
described_class.instance_variable_set(:@notifiers, {})
|
26
|
-
|
27
|
-
expect { described_class.__send__(method, 'bingo') }.
|
28
|
-
to raise_error(Airbrake::Error,
|
29
|
-
"the 'default' notifier isn't configured")
|
26
|
+
expect(described_class.__send__(method, 'bingo')).to be_nil
|
30
27
|
end
|
31
28
|
end
|
32
29
|
|
33
30
|
describe ".notify" do
|
34
|
-
include_examples '
|
31
|
+
include_examples 'non-configured notifier handling', :notify
|
35
32
|
|
36
33
|
it "sends exceptions asynchronously" do
|
37
34
|
described_class.notify('bingo')
|
@@ -41,7 +38,7 @@ RSpec.describe Airbrake do
|
|
41
38
|
end
|
42
39
|
|
43
40
|
describe ".notify_sync" do
|
44
|
-
include_examples '
|
41
|
+
include_examples 'non-configured notifier handling', :notify_sync
|
45
42
|
|
46
43
|
it "sends exceptions synchronously" do
|
47
44
|
expect(described_class.notify_sync('bingo')).to be_a(Hash)
|
@@ -97,14 +94,16 @@ RSpec.describe Airbrake do
|
|
97
94
|
include_examples(
|
98
95
|
'backtrace building',
|
99
96
|
'converts it to a RuntimeException and builds a fake backtrace',
|
100
|
-
'bingo'
|
97
|
+
'bingo'
|
98
|
+
)
|
101
99
|
end
|
102
100
|
|
103
101
|
context "given an Exception with missing backtrace" do
|
104
102
|
include_examples(
|
105
103
|
'backtrace building',
|
106
104
|
'builds a backtrace for it and sends the notice',
|
107
|
-
RuntimeError.new('bingo')
|
105
|
+
RuntimeError.new('bingo')
|
106
|
+
)
|
108
107
|
end
|
109
108
|
end
|
110
109
|
|
@@ -162,7 +161,7 @@ RSpec.describe Airbrake do
|
|
162
161
|
end
|
163
162
|
|
164
163
|
describe ".add_filter" do
|
165
|
-
include_examples '
|
164
|
+
include_examples 'non-configured notifier handling', :add_filter
|
166
165
|
|
167
166
|
it "adds filters with help of blocks" do
|
168
167
|
filter_chain = notifier.instance_variable_get(:@filter_chain)
|
@@ -178,14 +177,14 @@ RSpec.describe Airbrake do
|
|
178
177
|
end
|
179
178
|
|
180
179
|
describe ".whitelist_keys" do
|
181
|
-
include_examples '
|
180
|
+
include_examples 'non-configured notifier handling', :whitelist_keys
|
182
181
|
end
|
183
182
|
|
184
183
|
describe ".blacklist_keys" do
|
185
|
-
include_examples '
|
184
|
+
include_examples 'non-configured notifier handling', :blacklist_keys
|
186
185
|
end
|
187
186
|
|
188
187
|
describe ".build_notice" do
|
189
|
-
include_examples '
|
188
|
+
include_examples 'non-configured notifier handling', :build_notice
|
190
189
|
end
|
191
190
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: airbrake-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Airbrake Technologies, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|