bugsnag 6.17.0 → 6.18.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
  SHA256:
3
- metadata.gz: 7bc3da7c0b78fcf5ccdccee2cc11c2da66b0ed121efd6ee4959c3defa4faf78b
4
- data.tar.gz: 9ee38d85d5156b4820782f54076f4209c5adf333505f701e9498ed0eafd99a1a
3
+ metadata.gz: 29a2a991d8e578989dee9cd0d83e348641c8985c2ac59de3840abe7dbe2691da
4
+ data.tar.gz: a75ca7b1949633520ced32c604299f9f625f980d7d2efaabf253529d1e2acae6
5
5
  SHA512:
6
- metadata.gz: 6962b73237abdfed471b6fdb835a0fb57f6360dc86efa4c8bd2049c0c354332a214626a48c700e9e0edf29c6848678883d3cddd9bcc040b42057a6e7d03f2fe5
7
- data.tar.gz: 5e1a14700a57fc44f3d9ad9cf6f6208fe26a1bc590b92e56a56b5a5352891c7e75dd29c28a01a0edf7e297a23bb0728f5484205119a4476e768306e415db6fde
6
+ metadata.gz: a0dacb630c81e3a867df883040c3f6d16174706be29d56974b759850a9c19e6518e2fdb793365007b9d0caaecf2d8c18cc937e8df82d86fa8796fe5a08940bd2
7
+ data.tar.gz: 53d5f08ac9f375bfea5c629f0a1cf0b83684e4ae865058fdf2dd7939d9d36a888b1b87cb33af9fe04ce32e0daaca140a354c9eb4a5b3fa725a626348a47ef117
@@ -1,6 +1,16 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ ## 6.18.0 (27 October 2020)
5
+
6
+ ### Enhancements
7
+
8
+ * Bugsnag should now report uncaught exceptions inside Bundler's 'friendly errors'
9
+ | [#634](https://github.com/bugsnag/bugsnag-ruby/pull/634)
10
+
11
+ * Improve the display of breadrumbs in the Bugsnag app by including milliseconds in timestamps
12
+ | [#639](https://github.com/bugsnag/bugsnag-ruby/pull/639)
13
+
4
14
  ## 6.17.0 (27 August 2020)
5
15
 
6
16
  ### Enhancements
data/VERSION CHANGED
@@ -1 +1 @@
1
- 6.17.0
1
+ 6.18.0
@@ -25,7 +25,6 @@ require "bugsnag/middleware/rails3_request"
25
25
  require "bugsnag/middleware/sidekiq"
26
26
  require "bugsnag/middleware/mailman"
27
27
  require "bugsnag/middleware/rake"
28
- require "bugsnag/middleware/callbacks"
29
28
  require "bugsnag/middleware/classify_error"
30
29
  require "bugsnag/middleware/delayed_job"
31
30
 
@@ -136,7 +135,9 @@ module Bugsnag
136
135
  @exit_handler_added = true
137
136
  at_exit do
138
137
  if $!
139
- Bugsnag.notify($!, true) do |report|
138
+ exception = unwrap_bundler_exception($!)
139
+
140
+ Bugsnag.notify(exception, true) do |report|
140
141
  report.severity = 'error'
141
142
  report.severity_reason = {
142
143
  :type => Bugsnag::Report::UNHANDLED_EXCEPTION
@@ -390,6 +391,39 @@ module Bugsnag
390
391
 
391
392
  ::JSON.dump(trimmed)
392
393
  end
394
+
395
+ ##
396
+ # When running a script with 'bundle exec', uncaught exceptions will be
397
+ # converted to "friendly errors" which has the side effect of wrapping them
398
+ # in a SystemExit
399
+ #
400
+ # By default we ignore SystemExit, so need to unwrap the original exception
401
+ # in order to avoid ignoring real errors
402
+ #
403
+ # @param exception [Exception]
404
+ # @return [Exception]
405
+ def unwrap_bundler_exception(exception)
406
+ running_in_bundler = ENV.include?('BUNDLE_BIN_PATH')
407
+
408
+ # See if this exception came from Bundler's 'with_friendly_errors' method
409
+ return exception unless running_in_bundler
410
+ return exception unless exception.is_a?(SystemExit)
411
+ return exception unless exception.respond_to?(:cause)
412
+ return exception unless exception.backtrace.first.include?('/bundler/friendly_errors.rb')
413
+ return exception if exception.cause.nil?
414
+
415
+ unwrapped = exception.cause
416
+
417
+ # We may need to unwrap another level if the exception came from running
418
+ # an executable file directly (i.e. 'bundle exec <file>'). In this case
419
+ # there can be a SystemExit from 'with_friendly_errors' _and_ a SystemExit
420
+ # from 'kernel_load'
421
+ return unwrapped unless unwrapped.is_a?(SystemExit)
422
+ return unwrapped unless unwrapped.backtrace.first.include?('/bundler/cli/exec.rb')
423
+ return unwrapped if unwrapped.cause.nil?
424
+
425
+ unwrapped.cause
426
+ end
393
427
  end
394
428
  end
395
429
  # rubocop:enable Metrics/ModuleLength
@@ -69,7 +69,7 @@ module Bugsnag::Breadcrumbs
69
69
  :name => @name,
70
70
  :type => @type,
71
71
  :metaData => @meta_data,
72
- :timestamp => @timestamp.iso8601
72
+ :timestamp => @timestamp.iso8601(3)
73
73
  }
74
74
  end
75
75
  end
@@ -58,7 +58,7 @@ module Bugsnag
58
58
  def default_headers
59
59
  {
60
60
  "Content-Type" => "application/json",
61
- "Bugsnag-Sent-At" => Time.now().utc().strftime('%Y-%m-%dT%H:%M:%S')
61
+ "Bugsnag-Sent-At" => Time.now.utc.iso8601(3)
62
62
  }
63
63
  end
64
64
  end
@@ -94,11 +94,11 @@ module Bugsnag
94
94
 
95
95
  ##
96
96
  # Wrapper for trimming stacktraces
97
- def self.extract_exception(payload)
97
+ def self.extract_exception(payload, &block)
98
98
  valid_payload = payload.is_a?(Hash) && payload[:events].respond_to?(:map)
99
99
  return unless valid_payload && block_given?
100
100
  payload[:events].each do |event|
101
- event[:exceptions].each { |exception| yield exception }
101
+ event[:exceptions].each(&block)
102
102
  end
103
103
  end
104
104
 
@@ -209,7 +209,7 @@ module Bugsnag
209
209
  {
210
210
  "Bugsnag-Api-Key" => api_key,
211
211
  "Bugsnag-Payload-Version" => CURRENT_PAYLOAD_VERSION,
212
- "Bugsnag-Sent-At" => Time.now().utc().strftime('%Y-%m-%dT%H:%M:%S')
212
+ "Bugsnag-Sent-At" => Time.now.utc.iso8601(3)
213
213
  }
214
214
  end
215
215
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bugsnag
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.17.0
4
+ version: 6.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-27 00:00:00.000000000 Z
11
+ date: 2020-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby