rollbar 2.26.0 → 3.4.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 +4 -4
- data/.github/pull_request_template.md +34 -0
- data/.github/workflows/ci.yml +104 -0
- data/.rubocop.yml +52 -36
- data/Gemfile +25 -29
- data/README.md +32 -8
- data/data/rollbar.snippet.js +1 -1
- data/docs/configuration.md +7 -0
- data/gemfiles/rails30.gemfile +17 -35
- data/gemfiles/rails31.gemfile +20 -37
- data/gemfiles/rails32.gemfile +13 -31
- data/gemfiles/rails40.gemfile +12 -32
- data/gemfiles/rails41.gemfile +11 -31
- data/gemfiles/rails42.gemfile +11 -35
- data/gemfiles/rails50.gemfile +14 -32
- data/gemfiles/rails51.gemfile +13 -31
- data/gemfiles/rails52.gemfile +10 -19
- data/gemfiles/rails60.gemfile +10 -25
- data/gemfiles/rails61.gemfile +52 -0
- data/gemfiles/rails70.gemfile +52 -0
- data/lib/generators/rollbar/rollbar_generator.rb +18 -14
- data/lib/rails/rollbar_runner.rb +8 -19
- data/lib/rollbar/capistrano.rb +17 -9
- data/lib/rollbar/capistrano3.rb +8 -2
- data/lib/rollbar/capistrano_tasks.rb +44 -8
- data/lib/rollbar/configuration.rb +122 -88
- data/lib/rollbar/delay/shoryuken.rb +4 -3
- data/lib/rollbar/delay/sidekiq.rb +3 -1
- data/lib/rollbar/delay/sucker_punch.rb +1 -2
- data/lib/rollbar/delay/thread.rb +3 -2
- data/lib/rollbar/deploy.rb +6 -7
- data/lib/rollbar/encoding/encoder.rb +7 -3
- data/lib/rollbar/encoding.rb +2 -7
- data/lib/rollbar/exception_reporter.rb +17 -8
- data/lib/rollbar/item/backtrace.rb +10 -8
- data/lib/rollbar/item/frame.rb +6 -5
- data/lib/rollbar/item/locals.rb +5 -2
- data/lib/rollbar/item.rb +60 -38
- data/lib/rollbar/json.rb +1 -1
- data/lib/rollbar/language_support.rb +0 -6
- data/lib/rollbar/lazy_store.rb +3 -7
- data/lib/rollbar/logger.rb +2 -0
- data/lib/rollbar/logger_proxy.rb +3 -1
- data/lib/rollbar/middleware/js/json_value.rb +15 -5
- data/lib/rollbar/middleware/js.rb +59 -37
- data/lib/rollbar/middleware/rack/builder.rb +3 -3
- data/lib/rollbar/middleware/rack/test_session.rb +3 -3
- data/lib/rollbar/middleware/rack.rb +4 -4
- data/lib/rollbar/middleware/rails/rollbar.rb +9 -6
- data/lib/rollbar/middleware/rails/show_exceptions.rb +8 -4
- data/lib/rollbar/notifier/trace_with_bindings.rb +13 -3
- data/lib/rollbar/notifier.rb +180 -136
- data/lib/rollbar/plugin.rb +8 -8
- data/lib/rollbar/plugins/active_job.rb +15 -2
- data/lib/rollbar/plugins/delayed_job/plugin.rb +14 -3
- data/lib/rollbar/plugins/goalie.rb +27 -16
- data/lib/rollbar/plugins/rails/controller_methods.rb +18 -14
- data/lib/rollbar/plugins/rails/railtie30.rb +2 -1
- data/lib/rollbar/plugins/rails/railtie32.rb +2 -1
- data/lib/rollbar/plugins/rails/railtie_mixin.rb +2 -2
- data/lib/rollbar/plugins/rails.rb +5 -2
- data/lib/rollbar/plugins/rake.rb +2 -1
- data/lib/rollbar/plugins/sidekiq/plugin.rb +39 -21
- data/lib/rollbar/plugins/sidekiq.rb +1 -1
- data/lib/rollbar/plugins/thread.rb +8 -7
- data/lib/rollbar/plugins/validations.rb +3 -1
- data/lib/rollbar/rake_tasks.rb +1 -2
- data/lib/rollbar/request_data_extractor.rb +48 -19
- data/lib/rollbar/rollbar_test.rb +9 -118
- data/lib/rollbar/scrubbers/params.rb +13 -7
- data/lib/rollbar/scrubbers/url.rb +56 -17
- data/lib/rollbar/scrubbers.rb +1 -1
- data/lib/rollbar/truncation/remove_any_key_strategy.rb +4 -1
- data/lib/rollbar/truncation/remove_extra_strategy.rb +3 -1
- data/lib/rollbar/util/hash.rb +14 -7
- data/lib/rollbar/util/ip_anonymizer.rb +1 -1
- data/lib/rollbar/util.rb +19 -13
- data/lib/rollbar/version.rb +1 -1
- data/lib/rollbar.rb +12 -7
- data/lib/tasks/benchmark.rake +2 -1
- data/rollbar.gemspec +5 -3
- metadata +17 -12
- data/.travis.yml +0 -284
- data/lib/rollbar/encoding/legacy_encoder.rb +0 -20
- /data/lib/generators/rollbar/templates/{initializer.rb → initializer.erb} +0 -0
@@ -4,79 +4,82 @@ module Rollbar
|
|
4
4
|
class Configuration
|
5
5
|
SEND_EXTRA_FRAME_DATA_OPTIONS = [:none, :app, :all].freeze
|
6
6
|
|
7
|
-
attr_accessor :access_token
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
7
|
+
attr_accessor :access_token,
|
8
|
+
:anonymize_user_ip,
|
9
|
+
:async_handler,
|
10
|
+
:async_json_payload,
|
11
|
+
:async_skip_report_handler,
|
12
|
+
:backtrace_cleaner,
|
13
|
+
:branch,
|
14
|
+
:capture_uncaught,
|
15
|
+
:code_version,
|
16
|
+
:collect_user_ip,
|
17
|
+
:configured_options,
|
18
|
+
:custom_data_method,
|
19
|
+
:default_logger,
|
20
|
+
:delayed_job_enabled,
|
21
|
+
:disable_core_monkey_patch,
|
22
|
+
:disable_monkey_patch,
|
23
|
+
:disable_rack_monkey_patch,
|
24
|
+
:dj_threshold,
|
25
|
+
:enable_error_context,
|
26
|
+
:enabled,
|
27
|
+
:endpoint,
|
28
|
+
:environment,
|
29
|
+
:exception_level_filters,
|
30
|
+
:failover_handlers,
|
31
|
+
:filepath,
|
32
|
+
:files_processed_duration,
|
33
|
+
:files_processed_enabled,
|
34
|
+
:files_processed_size,
|
35
|
+
:files_with_pid_name_enabled,
|
36
|
+
:framework,
|
37
|
+
:ignore_internal_errors,
|
38
|
+
:ignored_person_ids,
|
39
|
+
:js_enabled,
|
40
|
+
:js_options,
|
41
|
+
:host,
|
42
|
+
:locals,
|
43
|
+
:log_payload,
|
44
|
+
:net_retries,
|
45
|
+
:open_timeout,
|
46
|
+
:payload_options,
|
47
|
+
:person_email_method,
|
48
|
+
:person_id_method,
|
49
|
+
:person_method,
|
50
|
+
:person_username_method,
|
51
|
+
:populate_empty_backtraces,
|
52
|
+
:proxy,
|
53
|
+
:raise_on_error,
|
54
|
+
:randomize_scrub_length,
|
55
|
+
:report_dj_data,
|
56
|
+
:request_timeout,
|
57
|
+
:root,
|
58
|
+
:safely,
|
59
|
+
:scrub_fields,
|
60
|
+
:scrub_password,
|
61
|
+
:scrub_user,
|
62
|
+
:scrub_whitelist,
|
63
|
+
:transmit,
|
64
|
+
:uncaught_exception_level,
|
65
|
+
:user_ip_obfuscator_secret,
|
66
|
+
:user_ip_rack_env_key,
|
67
|
+
:scrub_headers,
|
68
|
+
:sidekiq_threshold,
|
69
|
+
:sidekiq_use_scoped_block,
|
70
|
+
:use_async,
|
71
|
+
:use_exception_level_filters_default,
|
72
|
+
:use_payload_access_token,
|
73
|
+
:verify_ssl_peer,
|
74
|
+
:web_base,
|
75
|
+
:write_to_file
|
76
|
+
attr_reader :before_process,
|
77
|
+
:logger_level,
|
78
|
+
:project_gem_paths,
|
79
|
+
:send_extra_frame_data,
|
80
|
+
:transform,
|
81
|
+
:use_eventmachine
|
82
|
+
attr_writer :logger # seconds # bytes
|
80
83
|
|
81
84
|
alias safely? safely
|
82
85
|
|
@@ -84,12 +87,14 @@ module Rollbar
|
|
84
87
|
DEFAULT_WEB_BASE = 'https://rollbar.com'.freeze
|
85
88
|
|
86
89
|
def initialize
|
90
|
+
@access_token = nil
|
87
91
|
@async_handler = nil
|
88
92
|
@before_process = []
|
93
|
+
@branch = nil
|
89
94
|
@capture_uncaught = nil
|
90
95
|
@code_version = nil
|
91
96
|
@custom_data_method = nil
|
92
|
-
@default_logger = lambda { ::Logger.new(
|
97
|
+
@default_logger = lambda { ::Logger.new($stderr) }
|
93
98
|
@logger_level = :info
|
94
99
|
@delayed_job_enabled = true
|
95
100
|
@disable_monkey_patch = false
|
@@ -97,6 +102,7 @@ module Rollbar
|
|
97
102
|
@disable_rack_monkey_patch = false
|
98
103
|
@enable_error_context = true
|
99
104
|
@dj_threshold = 0
|
105
|
+
@async_skip_report_handler = nil
|
100
106
|
@enabled = nil # set to true when configure is called
|
101
107
|
@endpoint = DEFAULT_ENDPOINT
|
102
108
|
@environment = nil
|
@@ -107,7 +113,13 @@ module Rollbar
|
|
107
113
|
}
|
108
114
|
@failover_handlers = []
|
109
115
|
@framework = 'Plain'
|
116
|
+
@ignore_internal_errors = [
|
117
|
+
'Net::ReadTimeout',
|
118
|
+
'Net::OpenTimeout',
|
119
|
+
'SocketError'
|
120
|
+
]
|
110
121
|
@ignored_person_ids = []
|
122
|
+
@host = nil
|
111
123
|
@payload_options = {}
|
112
124
|
@person_method = 'current_user'
|
113
125
|
@person_id_method = 'id'
|
@@ -119,6 +131,7 @@ module Rollbar
|
|
119
131
|
@open_timeout = 3
|
120
132
|
@request_timeout = 3
|
121
133
|
@net_retries = 3
|
134
|
+
@root = nil
|
122
135
|
@js_enabled = false
|
123
136
|
@js_options = {}
|
124
137
|
@locals = {}
|
@@ -132,6 +145,7 @@ module Rollbar
|
|
132
145
|
@uncaught_exception_level = 'error'
|
133
146
|
@scrub_headers = ['Authorization']
|
134
147
|
@sidekiq_threshold = 0
|
148
|
+
@sidekiq_use_scoped_block = false
|
135
149
|
@safely = false
|
136
150
|
@transform = []
|
137
151
|
@use_async = false
|
@@ -148,6 +162,8 @@ module Rollbar
|
|
148
162
|
@log_payload = false
|
149
163
|
@collect_user_ip = true
|
150
164
|
@anonymize_user_ip = false
|
165
|
+
@user_ip_obfuscator_secret = nil
|
166
|
+
@user_ip_rack_env_key = nil
|
151
167
|
@backtrace_cleaner = nil
|
152
168
|
@hooks = {
|
153
169
|
:on_error_response => nil, # params: response
|
@@ -155,10 +171,12 @@ module Rollbar
|
|
155
171
|
}
|
156
172
|
|
157
173
|
@write_to_file = false
|
174
|
+
@filepath = nil
|
158
175
|
@files_with_pid_name_enabled = false
|
159
176
|
@files_processed_enabled = false
|
160
177
|
@files_processed_duration = 60
|
161
178
|
@files_processed_size = 5 * 1000 * 1000
|
179
|
+
@use_payload_access_token = false
|
162
180
|
|
163
181
|
@configured_options = ConfiguredOptions.new(self)
|
164
182
|
end
|
@@ -202,7 +220,8 @@ module Rollbar
|
|
202
220
|
def use_active_job(options = {})
|
203
221
|
require 'rollbar/delay/active_job'
|
204
222
|
|
205
|
-
Rollbar::Delay::ActiveJob.queue_as(options[:queue] ||
|
223
|
+
Rollbar::Delay::ActiveJob.queue_as(options[:queue] ||
|
224
|
+
Rollbar::Delay::ActiveJob.default_queue_name)
|
206
225
|
|
207
226
|
@use_async = true
|
208
227
|
@async_handler = Rollbar::Delay::ActiveJob
|
@@ -242,8 +261,13 @@ module Rollbar
|
|
242
261
|
end
|
243
262
|
|
244
263
|
def use_sidekiq=(value)
|
245
|
-
deprecation_message = '#use_sidekiq=(value) has been deprecated in favor
|
246
|
-
|
264
|
+
deprecation_message = '#use_sidekiq=(value) has been deprecated in favor ' \
|
265
|
+
'of #use_sidekiq(options = {}). Please update your rollbar configuration.'
|
266
|
+
if defined?(ActiveSupport)
|
267
|
+
ActiveSupport::Deprecation.warn(deprecation_message)
|
268
|
+
else
|
269
|
+
puts(deprecation_message)
|
270
|
+
end
|
247
271
|
|
248
272
|
value.is_a?(Hash) ? use_sidekiq(value) : use_sidekiq
|
249
273
|
end
|
@@ -262,8 +286,13 @@ module Rollbar
|
|
262
286
|
end
|
263
287
|
|
264
288
|
def use_sucker_punch=(_value)
|
265
|
-
deprecation_message = '#use_sucker_punch=(value) has been deprecated in
|
266
|
-
|
289
|
+
deprecation_message = '#use_sucker_punch=(value) has been deprecated in ' \
|
290
|
+
'favor of #use_sucker_punch. Please update your rollbar configuration.'
|
291
|
+
if defined?(ActiveSupport)
|
292
|
+
ActiveSupport::Deprecation.warn(deprecation_message)
|
293
|
+
else
|
294
|
+
puts(deprecation_message)
|
295
|
+
end
|
267
296
|
|
268
297
|
use_sucker_punch
|
269
298
|
end
|
@@ -294,7 +323,9 @@ module Rollbar
|
|
294
323
|
|
295
324
|
def send_extra_frame_data=(value)
|
296
325
|
unless SEND_EXTRA_FRAME_DATA_OPTIONS.include?(value)
|
297
|
-
logger.warning(
|
326
|
+
logger.warning(
|
327
|
+
"Wrong 'send_extra_frame_data' value, :none, :app or :all is expected"
|
328
|
+
)
|
298
329
|
|
299
330
|
return
|
300
331
|
end
|
@@ -320,14 +351,14 @@ module Rollbar
|
|
320
351
|
end
|
321
352
|
|
322
353
|
def hook(symbol, &block)
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
354
|
+
unless @hooks.key?(symbol)
|
355
|
+
raise StandardError, "Hook :#{symbol} is not supported by Rollbar SDK."
|
356
|
+
end
|
357
|
+
|
358
|
+
if block_given?
|
359
|
+
@hooks[symbol] = block
|
329
360
|
else
|
330
|
-
|
361
|
+
@hooks[symbol]
|
331
362
|
end
|
332
363
|
end
|
333
364
|
|
@@ -348,7 +379,10 @@ module Rollbar
|
|
348
379
|
return super unless configuration.respond_to?(method)
|
349
380
|
|
350
381
|
method_string = method.to_s
|
351
|
-
|
382
|
+
if method_string.end_with?('=')
|
383
|
+
configured[method_string.chomp('=').to_sym] =
|
384
|
+
args.first
|
385
|
+
end
|
352
386
|
|
353
387
|
configuration.send(method, *args, &block)
|
354
388
|
end
|
@@ -2,9 +2,10 @@ require 'shoryuken'
|
|
2
2
|
|
3
3
|
module Rollbar
|
4
4
|
module Delay
|
5
|
-
# Following class allows to send rollbars using Sho-ryu-ken as a background
|
6
|
-
#
|
7
|
-
#
|
5
|
+
# Following class allows to send rollbars using Sho-ryu-ken as a background
|
6
|
+
# jobs processor. See the queue_name method which states that your queues
|
7
|
+
# needs to be names as "rollbar_ENVIRONMENT". Retry intervals will be used
|
8
|
+
# to retry sending the same message again if failed before.
|
8
9
|
class Shoryuken
|
9
10
|
include ::Shoryuken::Worker
|
10
11
|
|
@@ -10,7 +10,9 @@ module Rollbar
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def call(payload)
|
13
|
-
|
13
|
+
return unless ::Sidekiq::Client.push(@options.merge('args' => [payload])).nil?
|
14
|
+
|
15
|
+
raise(StandardError, 'Unable to push the job to Sidekiq')
|
14
16
|
end
|
15
17
|
|
16
18
|
include ::Sidekiq::Worker
|
data/lib/rollbar/delay/thread.rb
CHANGED
@@ -62,11 +62,12 @@ module Rollbar
|
|
62
62
|
reaper.join
|
63
63
|
end
|
64
64
|
rescue Timeout::Error
|
65
|
-
raise TimeoutError,
|
65
|
+
raise TimeoutError,
|
66
|
+
"unable to reap all threads within #{EXIT_TIMEOUT} seconds"
|
66
67
|
end
|
67
68
|
end
|
68
69
|
end
|
69
|
-
end
|
70
|
+
end
|
70
71
|
|
71
72
|
def priority
|
72
73
|
self.class.options[:priority] || DEFAULT_PRIORITY
|
data/lib/rollbar/deploy.rb
CHANGED
@@ -30,9 +30,7 @@ module Rollbar
|
|
30
30
|
return {} unless access_token && !access_token.empty?
|
31
31
|
|
32
32
|
uri = ::URI.parse(
|
33
|
-
::Rollbar::Deploy::ENDPOINT
|
34
|
-
deploy_id.to_s +
|
35
|
-
'?access_token=' + access_token
|
33
|
+
"#{::Rollbar::Deploy::ENDPOINT}#{deploy_id}?access_token=#{access_token}"
|
36
34
|
)
|
37
35
|
|
38
36
|
request = ::Net::HTTP::Patch.new(uri.request_uri)
|
@@ -74,17 +72,18 @@ module Rollbar
|
|
74
72
|
|
75
73
|
def request_result(uri, request)
|
76
74
|
{
|
77
|
-
:request_info => uri.inspect
|
75
|
+
:request_info => "#{uri.inspect}: #{request.body}",
|
78
76
|
:request => request
|
79
77
|
}
|
80
78
|
end
|
81
79
|
|
82
80
|
def response_result(response)
|
81
|
+
code = response.code
|
82
|
+
message = response.message
|
83
|
+
body = response.body.delete("\n")
|
83
84
|
{
|
84
85
|
:response => response,
|
85
|
-
:response_info =>
|
86
|
-
response.message + '; ' +
|
87
|
-
response.body.delete("\n")
|
86
|
+
:response_info => "#{code}; #{message}; #{body}"
|
88
87
|
}.merge(::JSON.parse(response.body, :symbolize_names => true))
|
89
88
|
end
|
90
89
|
end
|
@@ -1,8 +1,10 @@
|
|
1
1
|
module Rollbar
|
2
2
|
module Encoding
|
3
3
|
class Encoder
|
4
|
-
ALL_ENCODINGS = [::Encoding::UTF_8, ::Encoding::ISO_8859_1, ::Encoding::ASCII_8BIT,
|
5
|
-
|
4
|
+
ALL_ENCODINGS = [::Encoding::UTF_8, ::Encoding::ISO_8859_1, ::Encoding::ASCII_8BIT,
|
5
|
+
::Encoding::US_ASCII].freeze
|
6
|
+
ASCII_ENCODINGS = [::Encoding::US_ASCII, ::Encoding::ASCII_8BIT,
|
7
|
+
::Encoding::ISO_8859_1].freeze
|
6
8
|
UTF8 = 'UTF-8'.freeze
|
7
9
|
BINARY = 'binary'.freeze
|
8
10
|
|
@@ -40,7 +42,9 @@ module Rollbar
|
|
40
42
|
def force_encoding(value)
|
41
43
|
return value if value.frozen?
|
42
44
|
|
43
|
-
|
45
|
+
if value.encoding == ::Encoding::UTF_8
|
46
|
+
value.force_encoding(detect_encoding(value))
|
47
|
+
end
|
44
48
|
|
45
49
|
value
|
46
50
|
end
|
data/lib/rollbar/encoding.rb
CHANGED
@@ -5,13 +5,8 @@ module Rollbar
|
|
5
5
|
end
|
6
6
|
|
7
7
|
def self.setup
|
8
|
-
|
9
|
-
|
10
|
-
self.encoding_class = Rollbar::Encoding::Encoder
|
11
|
-
else
|
12
|
-
require 'rollbar/encoding/legacy_encoder'
|
13
|
-
self.encoding_class = Rollbar::Encoding::LegacyEncoder
|
14
|
-
end
|
8
|
+
require 'rollbar/encoding/encoder'
|
9
|
+
self.encoding_class = Rollbar::Encoding::Encoder
|
15
10
|
end
|
16
11
|
|
17
12
|
def self.encode(object)
|
@@ -7,16 +7,23 @@ module Rollbar
|
|
7
7
|
|
8
8
|
exception_data = exception_data(exception)
|
9
9
|
|
10
|
-
|
10
|
+
case exception_data
|
11
|
+
when Hash
|
11
12
|
env['rollbar.exception_uuid'] = exception_data[:uuid]
|
12
|
-
Rollbar.log_debug
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Rollbar.log_debug(
|
14
|
+
"[Rollbar] Exception uuid saved in env: #{exception_data[:uuid]}"
|
15
|
+
)
|
16
|
+
when 'disabled'
|
17
|
+
Rollbar.log_debug(
|
18
|
+
'[Rollbar] Exception not reported because Rollbar is disabled'
|
19
|
+
)
|
20
|
+
when 'ignored'
|
16
21
|
Rollbar.log_debug '[Rollbar] Exception not reported because it was ignored'
|
17
22
|
end
|
18
23
|
rescue StandardError => e
|
19
|
-
Rollbar.log_warning
|
24
|
+
Rollbar.log_warning(
|
25
|
+
"[Rollbar] Exception while reporting exception to Rollbar: #{e.message}"
|
26
|
+
)
|
20
27
|
end
|
21
28
|
|
22
29
|
def capture_uncaught?
|
@@ -24,12 +31,14 @@ module Rollbar
|
|
24
31
|
end
|
25
32
|
|
26
33
|
def log_exception_message(exception)
|
27
|
-
exception_message = exception.respond_to?(:message)
|
34
|
+
exception_message = exception.message if exception.respond_to?(:message)
|
35
|
+
exception_message ||= 'No Exception Message'
|
28
36
|
Rollbar.log_debug "[Rollbar] Reporting exception: #{exception_message}"
|
29
37
|
end
|
30
38
|
|
31
39
|
def exception_data(exception)
|
32
|
-
Rollbar.log(Rollbar.configuration.uncaught_exception_level, exception,
|
40
|
+
Rollbar.log(Rollbar.configuration.uncaught_exception_level, exception,
|
41
|
+
:use_exception_level_filters => true)
|
33
42
|
end
|
34
43
|
end
|
35
44
|
end
|
@@ -3,11 +3,7 @@ require 'rollbar/item/frame'
|
|
3
3
|
module Rollbar
|
4
4
|
class Item
|
5
5
|
class Backtrace
|
6
|
-
attr_reader :exception
|
7
|
-
attr_reader :message
|
8
|
-
attr_reader :extra
|
9
|
-
attr_reader :configuration
|
10
|
-
attr_reader :files
|
6
|
+
attr_reader :exception, :message, :extra, :configuration, :files
|
11
7
|
|
12
8
|
private :files
|
13
9
|
|
@@ -54,7 +50,10 @@ module Rollbar
|
|
54
50
|
|
55
51
|
current_exception = exception
|
56
52
|
|
57
|
-
while current_exception.respond_to?(:cause) &&
|
53
|
+
while current_exception.respond_to?(:cause) &&
|
54
|
+
(cause = current_exception.cause) &&
|
55
|
+
cause.is_a?(Exception) &&
|
56
|
+
!visited.include?(cause)
|
58
57
|
traces << trace_data(cause)
|
59
58
|
visited << cause
|
60
59
|
current_exception = cause
|
@@ -100,7 +99,9 @@ module Rollbar
|
|
100
99
|
# are those from the user's Rollbar.error line until this method. We want
|
101
100
|
# to remove those lines.
|
102
101
|
def exception_backtrace(current_exception)
|
103
|
-
|
102
|
+
if current_exception.backtrace.respond_to?(:map)
|
103
|
+
return current_exception.backtrace
|
104
|
+
end
|
104
105
|
return [] unless configuration.populate_empty_backtraces
|
105
106
|
|
106
107
|
caller_backtrace = caller
|
@@ -109,7 +110,8 @@ module Rollbar
|
|
109
110
|
end
|
110
111
|
|
111
112
|
def rollbar_lib_gem_dir
|
112
|
-
Gem::Specification.find_by_name('rollbar').gem_dir
|
113
|
+
gem_dir = Gem::Specification.find_by_name('rollbar').gem_dir
|
114
|
+
"#{gem_dir}/lib"
|
113
115
|
end
|
114
116
|
end
|
115
117
|
end
|
data/lib/rollbar/item/frame.rb
CHANGED
@@ -6,9 +6,7 @@ module Rollbar
|
|
6
6
|
class Item
|
7
7
|
# Representation of the trace data per frame in the payload
|
8
8
|
class Frame
|
9
|
-
attr_reader :backtrace
|
10
|
-
attr_reader :frame
|
11
|
-
attr_reader :configuration
|
9
|
+
attr_reader :backtrace, :frame, :configuration
|
12
10
|
|
13
11
|
MAX_CONTEXT_LENGTH = 4
|
14
12
|
|
@@ -104,7 +102,8 @@ module Rollbar
|
|
104
102
|
|
105
103
|
def post_data(file_lines, lineno)
|
106
104
|
from_line = lineno
|
107
|
-
number_of_lines = [from_line + MAX_CONTEXT_LENGTH,
|
105
|
+
number_of_lines = [from_line + MAX_CONTEXT_LENGTH,
|
106
|
+
file_lines.size].min - from_line
|
108
107
|
|
109
108
|
file_lines[from_line, number_of_lines]
|
110
109
|
end
|
@@ -113,7 +112,9 @@ module Rollbar
|
|
113
112
|
to_line = lineno - 2
|
114
113
|
from_line = [to_line - MAX_CONTEXT_LENGTH + 1, 0].max
|
115
114
|
|
116
|
-
file_lines[from_line, (to_line - from_line + 1)].select
|
115
|
+
file_lines[from_line, (to_line - from_line + 1)].select do |line|
|
116
|
+
line && !line.empty?
|
117
|
+
end
|
117
118
|
end
|
118
119
|
end
|
119
120
|
end
|
data/lib/rollbar/item/locals.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'rollbar/notifier'
|
2
1
|
require 'rollbar/scrubbers/params'
|
3
2
|
require 'rollbar/util'
|
4
3
|
|
@@ -33,6 +32,8 @@ module Rollbar
|
|
33
32
|
end
|
34
33
|
|
35
34
|
def locals_for(frame)
|
35
|
+
return {} unless frame
|
36
|
+
|
36
37
|
{}.tap do |hash|
|
37
38
|
frame.local_variables.map do |var|
|
38
39
|
hash[var] = prepare_value(frame.local_variable_get(var))
|
@@ -59,7 +60,9 @@ module Rollbar
|
|
59
60
|
# truncation strategy for large payloads.
|
60
61
|
#
|
61
62
|
def prepare_value(value)
|
62
|
-
|
63
|
+
unless value.is_a?(Hash) || value.is_a?(Array)
|
64
|
+
return simple_value?(value) ? value : value.inspect
|
65
|
+
end
|
63
66
|
|
64
67
|
cloned_value = ::Rollbar::Util.deep_copy(value)
|
65
68
|
::Rollbar::Util.iterate_and_update_with_block(cloned_value) do |v|
|