sentry-raven 2.8.0 → 2.9.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
  SHA1:
3
- metadata.gz: b2c9069a9b5cfae47df6590266f31063b07347f4
4
- data.tar.gz: bacb13812cd83d2e16befab52f47c3cd08f481ec
3
+ metadata.gz: 32a99e5dd16326a16bdb037f3773713c67b94435
4
+ data.tar.gz: b54fdea58fbc249a01220ee8d16b29122fb9c36b
5
5
  SHA512:
6
- metadata.gz: 94aa454b77018b446f06d1daf50bc97679fc76d45362bf63e1e876fad72882a3363dfe83d0a68b03b04b1e4590b55578e451e42d2badb538b44322ef5b794a06
7
- data.tar.gz: e5a2752c30d82bbeeaece755f09a4f4660b58aee9172460968447f40958a6c3ff0fc02b267040c1476097b361a0bc2785b61220acfaff1351e8dff4202010bb3
6
+ metadata.gz: 55835591bde885dead10c56f4f8bd311becd2da910b761be9056a4d9f4519356ad6602e6a36f55891176f3e733ac359ab74c893908c97e81d0706fbb04d51bdc
7
+ data.tar.gz: a1e7af3943cf1fa7e8bf779ad348378439d82b548a729ac765110f8e90c558623c038082cd5e211540fa05cbaf153723d2351c355f0dbd4d92817650783f4aec
@@ -1,3 +1,9 @@
1
+ 2.9.0
2
+ -----
3
+
4
+ * FEATURE: Added `config.inspect_exception_causes_for_exclusion`. Determines if the exception cause should be inspected for `config.excluded_exceptions` option. [@effron, #872]
5
+
6
+
1
7
  2.8.0
2
8
  -----
3
9
 
@@ -23,6 +23,7 @@ require 'raven/transports'
23
23
  require 'raven/transports/http'
24
24
  require 'raven/utils/deep_merge'
25
25
  require 'raven/utils/real_ip'
26
+ require 'raven/utils/exception_cause_chain'
26
27
  require 'raven/instance'
27
28
 
28
29
  require 'forwardable'
@@ -1,7 +1,7 @@
1
1
  require 'uri'
2
2
 
3
3
  module Raven
4
- class Configuration
4
+ class Configuration # rubocop:disable Metrics/ClassLength
5
5
  # Directories to be recognized as part of your app. e.g. if you
6
6
  # have an `engines` dir at the root of your project, you may want
7
7
  # to set this to something like /(app|config|engines|lib)/
@@ -31,6 +31,10 @@ module Raven
31
31
  # You should probably append to this rather than overwrite it.
32
32
  attr_accessor :excluded_exceptions
33
33
 
34
+ # Boolean to check nested exceptions when deciding if to exclude. Defaults to false
35
+ attr_accessor :inspect_exception_causes_for_exclusion
36
+ alias inspect_exception_causes_for_exclusion? inspect_exception_causes_for_exclusion
37
+
34
38
  # DSN component - set automatically if DSN provided
35
39
  attr_accessor :host
36
40
 
@@ -205,6 +209,7 @@ module Raven
205
209
  self.environments = []
206
210
  self.exclude_loggers = []
207
211
  self.excluded_exceptions = IGNORE_DEFAULT.dup
212
+ self.inspect_exception_causes_for_exclusion = false
208
213
  self.linecache = ::Raven::LineCache.new
209
214
  self.logger = ::Raven::Logger.new(STDOUT)
210
215
  self.open_timeout = 1
@@ -349,14 +354,24 @@ module Raven
349
354
  logger.error "Error detecting release: #{ex.message}"
350
355
  end
351
356
 
352
- def excluded_exception?(exc)
353
- excluded_exceptions.any? { |x| get_exception_class(x) === exc }
357
+ def excluded_exception?(incoming_exception)
358
+ excluded_exceptions.any? do |excluded_exception|
359
+ matches_exception?(get_exception_class(excluded_exception), incoming_exception)
360
+ end
354
361
  end
355
362
 
356
363
  def get_exception_class(x)
357
364
  x.is_a?(Module) ? x : qualified_const_get(x)
358
365
  end
359
366
 
367
+ def matches_exception?(excluded_exception_class, incoming_exception)
368
+ if inspect_exception_causes_for_exclusion?
369
+ Raven::Utils::ExceptionCauseChain.exception_to_array(incoming_exception).any? { |cause| excluded_exception_class === cause }
370
+ else
371
+ excluded_exception_class === incoming_exception
372
+ end
373
+ end
374
+
360
375
  # In Ruby <2.0 const_get can't lookup "SomeModule::SomeClass" in one go
361
376
  def qualified_const_get(x)
362
377
  x = x.to_s
@@ -139,7 +139,7 @@ module Raven
139
139
 
140
140
  def add_exception_interface(exc)
141
141
  interface(:exception) do |exc_int|
142
- exceptions = exception_chain_to_array(exc)
142
+ exceptions = Raven::Utils::ExceptionCauseChain.exception_to_array(exc).reverse
143
143
  backtraces = Set.new
144
144
  exc_int.values = exceptions.map do |e|
145
145
  SingleExceptionInterface.new do |int|
@@ -237,20 +237,6 @@ module Raven
237
237
  ].map { |v| v.new(self) }
238
238
  end
239
239
 
240
- def exception_chain_to_array(exc)
241
- if exc.respond_to?(:cause) && exc.cause
242
- exceptions = [exc]
243
- while exc.cause
244
- exc = exc.cause
245
- break if exceptions.any? { |e| e.object_id == exc.object_id }
246
- exceptions << exc
247
- end
248
- exceptions.reverse!
249
- else
250
- [exc]
251
- end
252
- end
253
-
254
240
  def list_gem_specs
255
241
  # Older versions of Rubygems don't support iterating over all specs
256
242
  Hash[Gem::Specification.map { |spec| [spec.name, spec.version.to_s] }] if Gem::Specification.respond_to?(:map)
@@ -0,0 +1,19 @@
1
+ module Raven
2
+ module Utils
3
+ module ExceptionCauseChain
4
+ def self.exception_to_array(exception)
5
+ if exception.respond_to?(:cause) && exception.cause
6
+ exceptions = [exception]
7
+ while exception.cause
8
+ exception = exception.cause
9
+ break if exceptions.any? { |e| e.object_id == exception.object_id }
10
+ exceptions << exception
11
+ end
12
+ exceptions
13
+ else
14
+ [exception]
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  module Raven
3
3
  # Freezing this constant breaks in 1.9.x
4
- VERSION = "2.8.0" # rubocop:disable Style/MutableConstant
4
+ VERSION = "2.9.0" # rubocop:disable Style/MutableConstant
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sentry-raven
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.0
4
+ version: 2.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sentry Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-01-09 00:00:00.000000000 Z
11
+ date: 2019-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -96,6 +96,7 @@ files:
96
96
  - lib/raven/transports/http.rb
97
97
  - lib/raven/transports/stdout.rb
98
98
  - lib/raven/utils/deep_merge.rb
99
+ - lib/raven/utils/exception_cause_chain.rb
99
100
  - lib/raven/utils/real_ip.rb
100
101
  - lib/raven/version.rb
101
102
  - lib/sentry-raven-without-integrations.rb