airbrake-ruby 2.3.1 → 2.3.2
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/notice.rb +10 -14
- data/lib/airbrake-ruby/version.rb +1 -1
- data/spec/backtrace_spec.rb +8 -8
- data/spec/notifier_spec.rb +14 -0
- 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: 8fedcdefd7e46e06454e468865a2a9a6a5c6d54a
|
4
|
+
data.tar.gz: 870a24b542bd2503c83f62230c4627742bb7891c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a956495373f17953f7b2f587dfdf68e1e4cc1d51719903acde59f35bd8b38f0a7183da2c15e713d9bf13b252f355f54d83b3826e367731003312511d9a4b369a
|
7
|
+
data.tar.gz: 7193c4cbb25da97ed895c83309d3fc9cef392adec7ace13b38097e6caa3d609bb36d06ebc0c16a169668264da6011ccf27a3e0b9efb0c52803e4c4e06558b443
|
data/lib/airbrake-ruby/notice.rb
CHANGED
@@ -74,7 +74,7 @@ module Airbrake
|
|
74
74
|
session: {},
|
75
75
|
params: params
|
76
76
|
}
|
77
|
-
@stash = {}
|
77
|
+
@stash = { exception: exception }
|
78
78
|
@truncator = Airbrake::Truncator.new(PAYLOAD_MAX_SIZE)
|
79
79
|
|
80
80
|
extract_custom_attributes(exception)
|
@@ -141,8 +141,15 @@ module Airbrake
|
|
141
141
|
# @raise [Airbrake::Error] if the root value is not a Hash
|
142
142
|
def []=(key, value)
|
143
143
|
raise_if_ignored
|
144
|
-
|
145
|
-
|
144
|
+
|
145
|
+
unless WRITABLE_KEYS.include?(key)
|
146
|
+
raise Airbrake::Error,
|
147
|
+
":#{key} is not recognized among #{WRITABLE_KEYS}"
|
148
|
+
end
|
149
|
+
|
150
|
+
unless value.respond_to?(:to_hash)
|
151
|
+
raise Airbrake::Error, "Got #{value.class} value, wanted a Hash"
|
152
|
+
end
|
146
153
|
|
147
154
|
@payload[key] = value.to_hash
|
148
155
|
end
|
@@ -170,17 +177,6 @@ module Airbrake
|
|
170
177
|
raise Airbrake::Error, 'cannot access ignored notice'
|
171
178
|
end
|
172
179
|
|
173
|
-
def raise_if_unrecognized_key(key)
|
174
|
-
return if WRITABLE_KEYS.include?(key)
|
175
|
-
raise Airbrake::Error,
|
176
|
-
":#{key} is not recognized among #{WRITABLE_KEYS}"
|
177
|
-
end
|
178
|
-
|
179
|
-
def raise_if_non_hash_value(value)
|
180
|
-
return if value.respond_to?(:to_hash)
|
181
|
-
raise Airbrake::Error, "Got #{value.class} value, wanted a Hash"
|
182
|
-
end
|
183
|
-
|
184
180
|
def truncate
|
185
181
|
TRUNCATABLE_KEYS.each { |key| @truncator.truncate_object(self[key]) }
|
186
182
|
|
data/spec/backtrace_spec.rb
CHANGED
@@ -4,7 +4,7 @@ RSpec.describe Airbrake::Backtrace do
|
|
4
4
|
describe ".parse" do
|
5
5
|
context "UNIX backtrace" do
|
6
6
|
let(:parsed_backtrace) do
|
7
|
-
# rubocop:disable Metrics/LineLength, Style/HashSyntax,
|
7
|
+
# rubocop:disable Metrics/LineLength, Style/HashSyntax, Layout/SpaceAroundOperators, Layout/SpaceInsideHashLiteralBraces
|
8
8
|
[{:file=>"/home/kyrylo/code/airbrake/ruby/spec/spec_helper.rb", :line=>23, :function=>"<top (required)>"},
|
9
9
|
{:file=>"/opt/rubies/ruby-2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb", :line=>54, :function=>"require"},
|
10
10
|
{:file=>"/opt/rubies/ruby-2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb", :line=>54, :function=>"require"},
|
@@ -18,7 +18,7 @@ RSpec.describe Airbrake::Backtrace do
|
|
18
18
|
{:file=>"/home/kyrylo/.gem/ruby/2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb", :line=>73, :function=>"run"},
|
19
19
|
{:file=>"/home/kyrylo/.gem/ruby/2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb", :line=>41, :function=>"invoke"},
|
20
20
|
{:file=>"/home/kyrylo/.gem/ruby/2.2.2/gems/rspec-core-3.3.2/exe/rspec", :line=>4, :function=>"<main>"}]
|
21
|
-
# rubocop:enable Metrics/LineLength, Style/HashSyntax,
|
21
|
+
# rubocop:enable Metrics/LineLength, Style/HashSyntax, Layout/SpaceAroundOperators, Layout/SpaceInsideHashLiteralBraces
|
22
22
|
end
|
23
23
|
|
24
24
|
it "returns a properly formatted array of hashes" do
|
@@ -37,10 +37,10 @@ RSpec.describe Airbrake::Backtrace do
|
|
37
37
|
let(:ex) { AirbrakeTestError.new.tap { |e| e.set_backtrace(windows_bt) } }
|
38
38
|
|
39
39
|
let(:parsed_backtrace) do
|
40
|
-
# rubocop:disable Metrics/LineLength, Style/HashSyntax,
|
40
|
+
# rubocop:disable Metrics/LineLength, Style/HashSyntax, Layout/SpaceInsideHashLiteralBraces, Layout/SpaceAroundOperators
|
41
41
|
[{:file=>"C:/Program Files/Server/app/models/user.rb", :line=>13, :function=>"magic"},
|
42
42
|
{:file=>"C:/Program Files/Server/app/controllers/users_controller.rb", :line=>8, :function=>"index"}]
|
43
|
-
# rubocop:enable Metrics/LineLength, Style/HashSyntax,
|
43
|
+
# rubocop:enable Metrics/LineLength, Style/HashSyntax, Layout/SpaceInsideHashLiteralBraces, Layout/SpaceAroundOperators
|
44
44
|
end
|
45
45
|
|
46
46
|
it "returns a properly formatted array of hashes" do
|
@@ -52,7 +52,7 @@ RSpec.describe Airbrake::Backtrace do
|
|
52
52
|
|
53
53
|
context "JRuby Java exceptions" do
|
54
54
|
let(:backtrace_array) do
|
55
|
-
# rubocop:disable Metrics/LineLength, Style/HashSyntax,
|
55
|
+
# rubocop:disable Metrics/LineLength, Style/HashSyntax, Layout/SpaceInsideHashLiteralBraces, Layout/SpaceAroundOperators
|
56
56
|
[{:file=>"InstanceMethodInvoker.java", :line=>26, :function=>"org.jruby.java.invokers.InstanceMethodInvoker.call"},
|
57
57
|
{:file=>"Interpreter.java", :line=>126, :function=>"org.jruby.ir.interpreter.Interpreter.INTERPRET_EVAL"},
|
58
58
|
{:file=>"RubyKernel$INVOKER$s$0$3$eval19.gen", :line=>nil, :function=>"org.jruby.RubyKernel$INVOKER$s$0$3$eval19.call"},
|
@@ -64,7 +64,7 @@ RSpec.describe Airbrake::Backtrace do
|
|
64
64
|
{:file=>"Compiler.java", :line=>111, :function=>"org.jruby.ir.Compiler$1.load"},
|
65
65
|
{:file=>"Main.java", :line=>225, :function=>"org.jruby.Main.run"},
|
66
66
|
{:file=>"Main.java", :line=>197, :function=>"org.jruby.Main.main"}]
|
67
|
-
# rubocop:enable Metrics/LineLength, Style/HashSyntax,
|
67
|
+
# rubocop:enable Metrics/LineLength, Style/HashSyntax, Layout/SpaceInsideHashLiteralBraces, Layout/SpaceAroundOperators
|
68
68
|
end
|
69
69
|
|
70
70
|
it "returns a properly formatted array of hashes" do
|
@@ -145,11 +145,11 @@ RSpec.describe Airbrake::Backtrace do
|
|
145
145
|
let(:ex) { AirbrakeTestError.new.tap { |e| e.set_backtrace(generic_bt) } }
|
146
146
|
|
147
147
|
let(:parsed_backtrace) do
|
148
|
-
# rubocop:disable Metrics/LineLength, Style/HashSyntax,
|
148
|
+
# rubocop:disable Metrics/LineLength, Style/HashSyntax, Layout/SpaceInsideHashLiteralBraces, Layout/SpaceAroundOperators
|
149
149
|
[{:file=>"/home/bingo/bango/assets/stylesheets/error_pages.scss", :line=>139, :function=>"animation"},
|
150
150
|
{:file=>"/home/bingo/bango/assets/stylesheets/error_pages.scss", :line=>139, :function=>nil},
|
151
151
|
{:file=>"/home/bingo/.gem/ruby/2.2.2/gems/sass-3.4.20/lib/sass/tree/visitors/perform.rb", :line=>349, :function=>"block in visit_mixin"}]
|
152
|
-
# rubocop:enable Metrics/LineLength, Style/HashSyntax,
|
152
|
+
# rubocop:enable Metrics/LineLength, Style/HashSyntax, Layout/SpaceInsideHashLiteralBraces, Layout/SpaceAroundOperators
|
153
153
|
end
|
154
154
|
|
155
155
|
it "returns a properly formatted array of hashes" do
|
data/spec/notifier_spec.rb
CHANGED
@@ -514,6 +514,20 @@ RSpec.describe Airbrake::Notifier do
|
|
514
514
|
@airbrake.notify_sync(ex)
|
515
515
|
expect(a_request(:post, endpoint)).to have_been_made.once
|
516
516
|
end
|
517
|
+
|
518
|
+
it "ignores descendant classes" do
|
519
|
+
descendant = Class.new(AirbrakeTestError)
|
520
|
+
|
521
|
+
@airbrake.add_filter do |notice|
|
522
|
+
notice.ignore! if notice.stash[:exception].is_a?(AirbrakeTestError)
|
523
|
+
end
|
524
|
+
|
525
|
+
@airbrake.notify_sync(descendant.new('Not caring!'))
|
526
|
+
expect(a_request(:post, endpoint)).not_to have_been_made
|
527
|
+
|
528
|
+
@airbrake.notify_sync(RuntimeError.new('Catch me if you can!'))
|
529
|
+
expect(a_request(:post, endpoint)).to have_been_made.once
|
530
|
+
end
|
517
531
|
end
|
518
532
|
|
519
533
|
describe "#build_notice" do
|
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: 2.3.
|
4
|
+
version: 2.3.2
|
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: 2017-07-
|
11
|
+
date: 2017-07-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|