airbrake-ruby 2.3.1 → 2.3.2

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
  SHA1:
3
- metadata.gz: 0ce919afda5caeee7879b30e51fe5c377f9c1cd6
4
- data.tar.gz: b16af646964d8203f5327dc855880765729bfe67
3
+ metadata.gz: 8fedcdefd7e46e06454e468865a2a9a6a5c6d54a
4
+ data.tar.gz: 870a24b542bd2503c83f62230c4627742bb7891c
5
5
  SHA512:
6
- metadata.gz: 2b7cdb943b77a2b7c50f1c6a2872a717d0311ff76bca71fc2e61ba20af6e7961379e2684d6f7813e6412e202eae655524234b017326c49baacd3d39a9b9dcba7
7
- data.tar.gz: 4806cad79ca36383d4adb2aef849868b505345a0ee0ab91b33a079179e28f9289ba3ba3a37d9c8e6a04498ea2809ed5c4db7929a64b2155817e6d5c6bb818551
6
+ metadata.gz: a956495373f17953f7b2f587dfdf68e1e4cc1d51719903acde59f35bd8b38f0a7183da2c15e713d9bf13b252f355f54d83b3826e367731003312511d9a4b369a
7
+ data.tar.gz: 7193c4cbb25da97ed895c83309d3fc9cef392adec7ace13b38097e6caa3d609bb36d06ebc0c16a169668264da6011ccf27a3e0b9efb0c52803e4c4e06558b443
@@ -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
- raise_if_unrecognized_key(key)
145
- raise_if_non_hash_value(value)
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
 
@@ -4,5 +4,5 @@
4
4
  module Airbrake
5
5
  ##
6
6
  # @return [String] the library version
7
- AIRBRAKE_RUBY_VERSION = '2.3.1'.freeze
7
+ AIRBRAKE_RUBY_VERSION = '2.3.2'.freeze
8
8
  end
@@ -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, Style/SpaceAroundOperators, Style/SpaceInsideHashLiteralBraces
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,Style/SpaceAroundOperators, Style/SpaceInsideHashLiteralBraces
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, Style/SpaceInsideHashLiteralBraces, Style/SpaceAroundOperators
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, Style/SpaceInsideHashLiteralBraces, Style/SpaceAroundOperators
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, Style/SpaceInsideHashLiteralBraces, Style/SpaceAroundOperators
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, Style/SpaceInsideHashLiteralBraces, Style/SpaceAroundOperators
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, Style/SpaceInsideHashLiteralBraces, Style/SpaceAroundOperators
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, Style/SpaceInsideHashLiteralBraces, Style/SpaceAroundOperators
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
@@ -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.1
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-15 00:00:00.000000000 Z
11
+ date: 2017-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec