enhanced_errors 0.1.2 → 0.1.3

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: b74f8777e19b73bcfd4024c4d3191abf98acfa397adaf99252b80cbbabf583af
4
- data.tar.gz: 47df87c1b8820fc1f0c0bdea2abe48ad4ed817472b22d8728328b52397e21b4c
3
+ metadata.gz: d1c7e272782dc0e8d9b0d41ae7836fe1c4f21a1278e8f7166d778abe6027de01
4
+ data.tar.gz: 5c2d742bfe53aa52a889c160267820a1439f8905e3329acd962be5c37ad8eab4
5
5
  SHA512:
6
- metadata.gz: c1db064f46691c84d3321b735c4bbf3258aa9d6f71a1611096cbe21d9a52bd67a352cc750a2fe16ad5f9fb46911fd4111e5166f4bb08844e28b80b64ba4af7ee
7
- data.tar.gz: cb1664d2de142e882f6d408817ac9c7a8b0bb14a54dedf30fa35fde05ba215bed7b42c17eef3109ffa4e7736f35f9eb937eac1c37a6d9a7278a6a989baff070f
6
+ metadata.gz: 702f2835ec5cc4cb9b92223ba7a3d88636fc8d9dc0e2f2d82a69d1956fd0e81363b18ff272b1b342b7af4147b1d980835e432ce01164b37e7e3ec591595b6862
7
+ data.tar.gz: ae0de7863558ef646236ef8c53f54b41ed0bf6cfb917a3f2e00f4561afed20f0a2e4d4f5b9178b47c1e483d09acb314a5679ba4f3c34b5ca1e443987429ef6cb
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "enhanced_errors"
3
- spec.version = "0.1.2"
3
+ spec.version = "0.1.3"
4
4
  spec.authors = ["Eric Beland"]
5
5
 
6
6
  spec.summary = "Automatically enhance your errors with messages containing variable values from the moment they were raised."
@@ -378,13 +378,12 @@ class EnhancedErrors
378
378
  events << :rescue if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.3.0')
379
379
 
380
380
  @trace = TracePoint.new(*events) do |tp|
381
+ next if Thread.current[:enhanced_errors_processing]
382
+ Thread.current[:enhanced_errors_processing] = true
381
383
  exception = tp.raised_exception
382
384
  capture_me = EnhancedErrors.eligible_for_capture.call(exception)
383
-
384
385
  next unless capture_me
385
386
 
386
- next if Thread.current[:enhanced_errors_processing]
387
- Thread.current[:enhanced_errors_processing] = true
388
387
 
389
388
  exception = tp.raised_exception
390
389
  binding_context = tp.binding
@@ -461,6 +460,8 @@ class EnhancedErrors
461
460
  else
462
461
  puts "Invalid binding_info returned from on_capture, skipping."
463
462
  end
463
+ rescue => e
464
+ puts "Error in TracePoint block: #{e.message}"
464
465
  ensure
465
466
  Thread.current[:enhanced_errors_processing] = false
466
467
  end
@@ -472,7 +473,10 @@ class EnhancedErrors
472
473
  #
473
474
  # @return [String, nil] The current test name or `nil` if not in a test context.
474
475
  def test_name
475
- return RSpec&.current_example&.full_description if defined?(RSpec)
476
+ if defined?(RSpec)
477
+ return RSpec&.current_example&.full_description
478
+ end
479
+ rescue => e
476
480
  nil
477
481
  end
478
482
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enhanced_errors
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Beland
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-23 00:00:00.000000000 Z
11
+ date: 2024-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: awesome_print