sentry-raven 2.2.0 → 2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7d602b648b5c1c87ce074dc68be686aeca0b6752
4
- data.tar.gz: c6c6219649f4e8ab1f2c015f3ce6eac40ee51a39
3
+ metadata.gz: 1d47eee39c7781d07673b21c829027ae9ff2a4e3
4
+ data.tar.gz: 14406d91d68320529521e749b2392ead1e59a95c
5
5
  SHA512:
6
- metadata.gz: eed297ddb38d1321c24c5abde706eb899d185de9fb3d3650679201e4cabe45a6594623ef9117e3df9c68ad857952d1a23701f66ab7af6ced344718a6cf798dcc
7
- data.tar.gz: 1143923e646e592a227a86fdbe962d93abe366c381bda6b23dff9dbd5b1b1cfef42ef8c00e4682babdaa3752e8338c9cae2960dd6d7ee6718eae9e9f3c89fde4
6
+ metadata.gz: aeb178b4827443e9dcfe3bd2299e772d9b0f69c42a8e6a281574dec4152d6f976ebd12b8d2aed490073111ad21624e6443f8bf6829d74dc6e2701eaed6b245f2
7
+ data.tar.gz: 4cd7b703b9cc39c8e838429daef8a24bb70de46d4397bcb9a93c9c1731b51acd600096e1f9db5a83de4e3a7fe498fa69e48fdb92c75f39b14f1ec01f465a5f07
@@ -32,7 +32,7 @@ module Raven
32
32
  return
33
33
  end
34
34
 
35
- configuration.logger.debug "Sending event #{event[:event_id]} to Sentry"
35
+ configuration.logger.info "Sending event #{event[:event_id]} to Sentry"
36
36
 
37
37
  content_type, encoded_data = encode(event)
38
38
 
@@ -1,4 +1,3 @@
1
- require 'logger'
2
1
  require 'uri'
3
2
 
4
3
  module Raven
@@ -261,19 +260,16 @@ module Raven
261
260
 
262
261
  def capture_allowed?(message_or_exc = nil)
263
262
  @errors = []
264
- @errors = valid? +
265
- capture_in_current_environment? +
266
- capture_allowed_by_callback?(message_or_exc)
267
- if @errors.any?
268
- false
269
- else
270
- true
271
- end
263
+
264
+ valid? &&
265
+ capture_in_current_environment? &&
266
+ capture_allowed_by_callback?(message_or_exc)
272
267
  end
273
268
  # If we cannot capture, we cannot send.
274
269
  alias sending_allowed? capture_allowed?
275
270
 
276
271
  def error_messages
272
+ @errors = [errors[0]] + errors[1..-1].map(&:downcase) # fix case of all but first
277
273
  errors.join(", ")
278
274
  end
279
275
 
@@ -315,23 +311,27 @@ module Raven
315
311
  end
316
312
 
317
313
  def capture_in_current_environment?
318
- if environments.any? && !environments.include?(current_environment)
319
- ["Not configured to send/capture in environment '#{current_environment}'"]
320
- else
321
- []
322
- end
314
+ return true unless environments.any? && !environments.include?(current_environment)
315
+ @errors << "Not configured to send/capture in environment '#{current_environment}'"
316
+ false
323
317
  end
324
318
 
325
319
  def capture_allowed_by_callback?(message_or_exc)
326
- return [] if !should_capture || message_or_exc.nil? || should_capture.call(*[message_or_exc])
327
- ["should_capture returned false"]
320
+ return true if !should_capture || message_or_exc.nil? || should_capture.call(*[message_or_exc])
321
+ @errors << "should_capture returned false"
322
+ false
328
323
  end
329
324
 
330
325
  def valid?
331
- err = %w(server host path public_key secret_key project_id).map do |key|
332
- "No #{key} specified" unless public_send(key)
326
+ return true if %w(server host path public_key secret_key project_id).all? { |k| public_send(k) }
327
+ if server
328
+ %w(server host path public_key secret_key project_id).map do |key|
329
+ @errors << "No #{key} specified" unless public_send(key)
330
+ end
331
+ else
332
+ @errors << "DSN not set"
333
333
  end
334
- err.compact
334
+ false
335
335
  end
336
336
 
337
337
  # Try to resolve the hostname to an FQDN, but fall back to whatever
@@ -96,17 +96,17 @@ module Raven
96
96
  configuration = options[:configuration] || Raven.configuration
97
97
  if exc.is_a?(Raven::Error)
98
98
  # Try to prevent error reporting loops
99
- configuration.logger.info "Refusing to capture Raven error: #{exc.inspect}"
99
+ configuration.logger.debug "Refusing to capture Raven error: #{exc.inspect}"
100
100
  return nil
101
101
  end
102
102
  if configuration[:excluded_exceptions].any? { |x| get_exception_class(x) === exc }
103
- configuration.logger.info "User excluded error: #{exc.inspect}"
103
+ configuration.logger.debug "User excluded error: #{exc.inspect}"
104
104
  return nil
105
105
  end
106
106
 
107
107
  new(options) do |evt|
108
108
  evt.configuration = configuration
109
- evt.message = "#{exc.class}: #{exc.message}"
109
+ evt.message = "#{exc.class}: #{exc.message}".byteslice(0...10_000) # Messages limited to 10kb
110
110
  evt.level = options[:level] || :error
111
111
 
112
112
  add_exception_interface(evt, exc)
@@ -34,8 +34,8 @@ module Raven
34
34
 
35
35
  config.after_initialize do
36
36
  Raven.configure do |config|
37
- config.logger ||= ::Rails.logger
38
37
  config.project_root ||= ::Rails.root
38
+ config.logger ||= ::Rails.logger
39
39
  config.release ||= config.detect_release # if project_root has changed, need to re-check
40
40
  end
41
41
 
@@ -8,6 +8,7 @@ module Raven
8
8
 
9
9
  def initialize(*)
10
10
  super
11
+ @level = ::Logger::INFO
11
12
  original_formatter = ::Logger::Formatter.new
12
13
  @default_formatter = proc do |severity, datetime, _progname, msg|
13
14
  msg = "#{LOG_PREFIX}#{msg}"
@@ -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.2.0" # rubocop:disable Style/MutableConstant
4
+ VERSION = "2.3.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.2.0
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sentry Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-05 00:00:00.000000000 Z
11
+ date: 2017-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -193,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
193
193
  version: '0'
194
194
  requirements: []
195
195
  rubyforge_project:
196
- rubygems_version: 2.5.2
196
+ rubygems_version: 2.6.8
197
197
  signing_key:
198
198
  specification_version: 4
199
199
  summary: A gem that provides a client interface for the Sentry error logger