rollbar 3.5.2 → 3.6.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
  SHA256:
3
- metadata.gz: a0a67fdd109dbc4ad80b42d5fee83b86d4c238f173e36f21fcccd7824309bf4a
4
- data.tar.gz: ddada3a7d29b64307fa73e45a430d43ae8ee470dae670e15b5994da69fddd601
3
+ metadata.gz: 2d1721c6b5e557cff0a0ddc98b068e7ce4026332d59f3de679ac0dddbe0c4199
4
+ data.tar.gz: 5863f686509bc77b0756f268cfc280fabeb00da1eacb8cd4bc9647f7cc57088b
5
5
  SHA512:
6
- metadata.gz: 682314257603690332897347973e469f72efe8d320480a906e2ea73da3f3a22dd37f5af254c329a0484cc7327d17caa24e69bf0b3381a2ebb73d4c22413a98ad
7
- data.tar.gz: c7d766e933113335f15bc0622bfbf8183e41110531d3cc76ead5aa786f7be7ed19d472dd5855de56110970c4871519d3a2dc9067e5a4c25cdf02009f1303495f
6
+ metadata.gz: ce2ec0e2f6fbd82f0b6b1a362a9f3c27d5d6b41acd17b716fb7731b2c0e36ef74bed289ad2c266d69c7f24aba78cd818d79ae37d79dad6bf8f7ada53b00f9ef0
7
+ data.tar.gz: 9b32084364e461fc7eb1ca9fd8b31fae0928298ed7da14a2688608d80a4502cf08b13190139275f4d39b0cb8fd2a5dce4ab35ba528d2c0a414ddfb561bf32670
data/.rubocop.yml CHANGED
@@ -65,9 +65,9 @@ Style/FrozenStringLiteralComment:
65
65
  Enabled: false
66
66
 
67
67
  Style/HashSyntax:
68
- EnforcedStyle: hash_rockets
68
+ EnforcedStyle: no_mixed_keys
69
69
  SupportedStyles:
70
- - hash_rockets
70
+ - no_mixed_keys
71
71
 
72
72
  Style/Lambda:
73
73
  Enabled: false
@@ -76,6 +76,7 @@ module Rollbar
76
76
  :web_base,
77
77
  :write_to_file
78
78
  attr_reader :before_process,
79
+ :enable_rails_error_subscriber,
79
80
  :logger_level,
80
81
  :project_gem_paths,
81
82
  :send_extra_frame_data,
@@ -104,6 +105,7 @@ module Rollbar
104
105
  @disable_core_monkey_patch = false
105
106
  @disable_rack_monkey_patch = false
106
107
  @enable_error_context = true
108
+ @enable_rails_error_subscriber = false
107
109
  @dj_threshold = 0
108
110
  @dj_use_scoped_block = false
109
111
  @async_skip_report_handler = nil
@@ -337,6 +339,20 @@ module Rollbar
337
339
  @send_extra_frame_data = value
338
340
  end
339
341
 
342
+ def enable_rails_error_subscriber=(enable)
343
+ return if !defined?(::Rails) || ::Rails.gem_version < ::Gem::Version.new('7.1.0')
344
+
345
+ if @enable_rails_error_subscriber && !enable
346
+ ::Rails.error.unsubscribe(Rollbar::ErrorSubscriber)
347
+ end
348
+
349
+ if !@enable_rails_error_subscriber && enable
350
+ ::Rails.error.subscribe(Rollbar::ErrorSubscriber.new)
351
+ end
352
+
353
+ @enable_rails_error_subscriber = enable
354
+ end
355
+
340
356
  # allow params to be read like a hash
341
357
  def [](option)
342
358
  send(option)
@@ -27,7 +27,8 @@ module Rollbar
27
27
  end
28
28
 
29
29
  def capture_uncaught?
30
- Rollbar.configuration.capture_uncaught != false
30
+ Rollbar.configuration.capture_uncaught != false &&
31
+ !Rollbar.configuration.enable_rails_error_subscriber
31
32
  end
32
33
 
33
34
  def log_exception_message(exception)
@@ -17,12 +17,10 @@ module Rollbar
17
17
  class Logger < ::Logger
18
18
  class Error < RuntimeError; end
19
19
 
20
- class DatetimeFormatNotSupported < Error; end
21
-
22
- class FormatterNotSupported < Error; end
23
-
24
20
  def initialize
25
- @level = ERROR
21
+ super(nil)
22
+
23
+ self.level = ERROR
26
24
  end
27
25
 
28
26
  def add(severity, message = nil, progname = nil)
@@ -39,22 +37,6 @@ module Rollbar
39
37
  error(message)
40
38
  end
41
39
 
42
- def formatter=(_)
43
- raise(FormatterNotSupported)
44
- end
45
-
46
- def formatter
47
- raise(FormatterNotSupported)
48
- end
49
-
50
- def datetime_format=(_)
51
- raise(DatetimeFormatNotSupported)
52
- end
53
-
54
- def datetime_format
55
- raise(DatetimeFormatNotSupported)
56
- end
57
-
58
40
  # Returns a Rollbar::Notifier instance with the current global scope and
59
41
  # with a logger writing to /dev/null so we don't have a infinite loop
60
42
  # when Rollbar.configuration.logger is Rails.logger.
@@ -0,0 +1,12 @@
1
+ module Rollbar
2
+ class ErrorSubscriber
3
+ def report(error, handled:, severity:, context:, source: nil)
4
+ # The default `nil` for capture_uncaught means `true`. so check for false.
5
+ return unless handled || Rollbar.configuration.capture_uncaught != false
6
+
7
+ extra = context.is_a?(Hash) ? context.deep_dup : {}
8
+ extra[:custom_data_method_context] = source
9
+ Rollbar.log(severity, error, extra)
10
+ end
11
+ end
12
+ end
@@ -79,3 +79,11 @@ Rollbar.plugins.define('rails-rollbar.js') do
79
79
  Rollbar::Js::Frameworks::Rails.new.load(self)
80
80
  end
81
81
  end
82
+
83
+ Rollbar.plugins.define('rails-error-subscriber') do
84
+ dependency { defined?(Rails::VERSION) && Rails::VERSION::MAJOR >= 7 }
85
+
86
+ execute! do
87
+ require 'rollbar/plugins/rails/error_subscriber'
88
+ end
89
+ end
@@ -1,3 +1,3 @@
1
1
  module Rollbar
2
- VERSION = '3.5.2'.freeze
2
+ VERSION = '3.6.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rollbar
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.2
4
+ version: 3.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rollbar, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-20 00:00:00.000000000 Z
11
+ date: 2024-08-30 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Track and debug errors in your Ruby applications with ease using Rollbar.
14
14
  With this gem, you can easily monitor and report on exceptions and other errors
@@ -101,6 +101,7 @@ files:
101
101
  - lib/rollbar/plugins/rack.rb
102
102
  - lib/rollbar/plugins/rails.rb
103
103
  - lib/rollbar/plugins/rails/controller_methods.rb
104
+ - lib/rollbar/plugins/rails/error_subscriber.rb
104
105
  - lib/rollbar/plugins/rails/railtie30.rb
105
106
  - lib/rollbar/plugins/rails/railtie32.rb
106
107
  - lib/rollbar/plugins/rails/railtie_mixin.rb