enhanced_errors 0.1.2 → 0.1.3
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/enhanced_errors.gemspec +1 -1
- data/lib/enhanced_errors.rb +8 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1c7e272782dc0e8d9b0d41ae7836fe1c4f21a1278e8f7166d778abe6027de01
|
4
|
+
data.tar.gz: 5c2d742bfe53aa52a889c160267820a1439f8905e3329acd962be5c37ad8eab4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 702f2835ec5cc4cb9b92223ba7a3d88636fc8d9dc0e2f2d82a69d1956fd0e81363b18ff272b1b342b7af4147b1d980835e432ce01164b37e7e3ec591595b6862
|
7
|
+
data.tar.gz: ae0de7863558ef646236ef8c53f54b41ed0bf6cfb917a3f2e00f4561afed20f0a2e4d4f5b9178b47c1e483d09acb314a5679ba4f3c34b5ca1e443987429ef6cb
|
data/enhanced_errors.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = "enhanced_errors"
|
3
|
-
spec.version = "0.1.
|
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."
|
data/lib/enhanced_errors.rb
CHANGED
@@ -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
|
-
|
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.
|
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-
|
11
|
+
date: 2024-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: awesome_print
|