bugsnag 6.25.0 → 6.25.1

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: b368e5f42be9d382e6a4fc6900155646612e86378597604162f9ca3ac7a9f9bd
4
- data.tar.gz: 380fb1702fd23efb10d3a0155e2c7909f3b599cc6e7863bd4e6b3f057b06c2db
3
+ metadata.gz: 3925f676929998c1f9738c6b7f82a174d3c87f13b5cc289da021c0d39160a0e5
4
+ data.tar.gz: 222b3cba78251ff98b80acab3c7129028714e714dbff8160a423e0b17e39db87
5
5
  SHA512:
6
- metadata.gz: df743de96ef2f1fcb04c3b38cbcf7c9ff293926d5ce7373b990a1512cfcf1707e90dee8e1cd04d34c37c34359138123f8b6da537cebd933d24f7b3e5afe3c5e0
7
- data.tar.gz: 7aadfbaeec36c193d50d144cb4bcd2d09a8072156d1dd5c96bc5a8c7a2b262ca6ed7c24321216b1239e9ce3b22cd2a3cfef07f8f4fba58ed5004bbe6e11b8b5e
6
+ metadata.gz: afb3ffe1e94f6a2ce20b22d16ab216f64a48c0f133618f6dc94ea5700e3e7f3a9554db70ebf98bf2db94acc884a8acb06d26c82996d3f8cce17ad164bb44a931
7
+ data.tar.gz: a988e117863633052de9bcbce5ca436823c106e075a2ef7f783afd33f74ca508392022fd2489e96f912d9815fd11137e572639855fb354edeb3c45b141018cc9
data/CHANGELOG.md CHANGED
@@ -1,7 +1,19 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
- ## v6.26.0 (1 December 2022)
4
+ ## v6.25.1 (5 January 2023)
5
+
6
+ ### Fixes
7
+
8
+ * Allow Gem paths to be stripped from file names in stacktraces when they contain a Regexp special character
9
+ | [#764](https://github.com/bugsnag/bugsnag-ruby/pull/764)
10
+
11
+ ### Enhancements
12
+
13
+ * Use `Exception#detailed_message` instead of `Exception#message` when available
14
+ | [#761](https://github.com/bugsnag/bugsnag-ruby/pull/761)
15
+
16
+ ## v6.25.0 (1 December 2022)
5
17
 
6
18
  ### Enhancements
7
19
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 6.25.0
1
+ 6.25.1
data/bugsnag.gemspec CHANGED
@@ -27,4 +27,13 @@ Gem::Specification.new do |s|
27
27
  else
28
28
  s.add_runtime_dependency 'concurrent-ruby', '~> 1.0'
29
29
  end
30
+
31
+ if s.respond_to?(:metadata=)
32
+ s.metadata = {
33
+ "changelog_uri" => "https://github.com/bugsnag/bugsnag-ruby/blob/HEAD/CHANGELOG.md",
34
+ "documentation_uri" => "https://docs.bugsnag.com/platforms/ruby/",
35
+ "source_code_uri" => "https://github.com/bugsnag/bugsnag-ruby/",
36
+ "rubygems_mfa_required" => "true"
37
+ }
38
+ end
30
39
  end
@@ -10,23 +10,25 @@ module Bugsnag::Middleware
10
10
  @bugsnag = bugsnag
11
11
  end
12
12
 
13
- def call(report)
13
+ def call(event)
14
14
  matches = []
15
- report.raw_exceptions.each do |exception|
16
- match = CAPTURE_REGEX.match(exception.message)
15
+
16
+ event.errors.each do |error|
17
+ match = CAPTURE_REGEX.match(error.error_message)
18
+
17
19
  next unless match
18
20
 
19
21
  suggestions = match.captures[0].split(DELIMITER)
20
- matches.concat suggestions.map{ |suggestion| suggestion.strip }
22
+ matches.concat(suggestions.map(&:strip))
21
23
  end
22
24
 
23
25
  if matches.size == 1
24
- report.add_tab(:error, {:suggestion => matches.first})
26
+ event.add_metadata(:error, { suggestion: matches.first })
25
27
  elsif matches.size > 1
26
- report.add_tab(:error, {:suggestions => matches})
28
+ event.add_metadata(:error, { suggestions: matches })
27
29
  end
28
30
 
29
- @bugsnag.call(report)
31
+ @bugsnag.call(event)
30
32
  end
31
33
  end
32
34
  end
@@ -428,9 +428,11 @@ module Bugsnag
428
428
 
429
429
  def generate_exception_list
430
430
  raw_exceptions.map do |exception|
431
+ class_name = error_class(exception)
432
+
431
433
  {
432
- errorClass: error_class(exception),
433
- message: exception.message,
434
+ errorClass: class_name,
435
+ message: error_message(exception, class_name),
434
436
  stacktrace: Stacktrace.process(exception.backtrace, configuration)
435
437
  }
436
438
  end
@@ -448,6 +450,26 @@ module Bugsnag
448
450
  (exception.is_a? Class) ? exception.name : exception.class.name
449
451
  end
450
452
 
453
+ def error_message(exception, class_name)
454
+ # Ruby 3.2 added Exception#detailed_message for Gems like "Did you mean"
455
+ # to annotate an exception's message
456
+ return exception.message unless exception.respond_to?(:detailed_message)
457
+
458
+ # the "highlight" argument may add terminal escape codes to the output,
459
+ # which we don't want to include
460
+ # it _should_ always be present but it's possible to forget to add it or
461
+ # to have implemented this method before Ruby 3.2
462
+ message =
463
+ begin
464
+ exception.detailed_message(highlight: false)
465
+ rescue ArgumentError
466
+ exception.detailed_message
467
+ end
468
+
469
+ # remove the class name to be consistent with Exception#message
470
+ message.sub(" (#{class_name})", '')
471
+ end
472
+
451
473
  def generate_raw_exceptions(exception)
452
474
  exceptions = []
453
475
 
@@ -48,7 +48,9 @@ module Bugsnag
48
48
 
49
49
  # Strip common gem path prefixes
50
50
  if defined?(Gem)
51
- file = Gem.path.inject(file) {|line, path| line.sub(/#{path}\//, "") }
51
+ Gem.path.each do |path|
52
+ file.sub!("#{path}/", "")
53
+ end
52
54
  end
53
55
 
54
56
  trace_hash[:file] = file
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.25.0
4
+ version: 6.25.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-01 00:00:00.000000000 Z
11
+ date: 2023-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -106,7 +106,11 @@ files:
106
106
  homepage: https://github.com/bugsnag/bugsnag-ruby
107
107
  licenses:
108
108
  - MIT
109
- metadata: {}
109
+ metadata:
110
+ changelog_uri: https://github.com/bugsnag/bugsnag-ruby/blob/HEAD/CHANGELOG.md
111
+ documentation_uri: https://docs.bugsnag.com/platforms/ruby/
112
+ source_code_uri: https://github.com/bugsnag/bugsnag-ruby/
113
+ rubygems_mfa_required: 'true'
110
114
  post_install_message:
111
115
  rdoc_options: []
112
116
  require_paths: