enhanced_errors 0.1.5 → 0.1.6

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: 62b2a3fc44ab649a8a20dafe2f144b73047a1d1cd63f9ed539d79b3ce912cf93
4
- data.tar.gz: 7b1af394f468c3ab240f20b61b4275384b2e1b16ffdd9296d7f0480cefcd17d1
3
+ metadata.gz: 58869aa7d7b2b2e3fb4f983ec425c909fd231396920da0283dc53a84afd943fe
4
+ data.tar.gz: 3ec8adc214e86d163930a0500ccb869221be072469dcc99cb0ab5f6150b851e5
5
5
  SHA512:
6
- metadata.gz: a290300d7c90b09b6551daff97c945ba6b5f523760fee3950c6e7cf45665ba61665619156a32a5841861f1405a1454dbf1bcae8e07de7bc0a26b71d3b7f3a7bf
7
- data.tar.gz: 4e3156d2e01bef30ce0a4c467382625eae7a93b4cb3b4ed8cfc103c7dd112514eb0865ad42bead9b068248682e19d5c7c43143e5495036937824860d9a004a7f
6
+ metadata.gz: cd0dcfd36be230736ce342db302c01002b6ce06bc9e7eb967d5870121002707fc6d30cb25efc0f7cec101350d8b670db7b4168ca5759a8fe1940537de2b7e620
7
+ data.tar.gz: e5d1bc47e7cc8efe21627225e520a332bc48efba549eb408d1420332f510f88f8f491ff4caf3979c07c620c9a5c5423db670ba0eec32ef769f764b0a9afdab2a
data/.yardoc/checksums CHANGED
@@ -1,4 +1,4 @@
1
1
  lib/colors.rb a4314ef9531d4713907c3fea22955c943fdb8cf3
2
2
  lib/binding.rb fdd7d5a2dd2edde22e3b10773510738dcdce4aeb
3
- lib/enhanced_errors.rb 5c7cd4a2a693b60bd34a0952e411db3578a1e72f
4
- lib/error_enhancements.rb d173fd391911b83485277f5c4a8b80c4e1178d36
3
+ lib/enhanced_errors.rb d12ce0629f2565e5179ae5076be8a495e19ecda2
4
+ lib/error_enhancements.rb a97d0f139d35f6e1b5bf49386271b1f4cf71761c
data/.yardoc/object_types CHANGED
Binary file
Binary file
data/README.md CHANGED
@@ -64,14 +64,14 @@ end
64
64
  ## Features
65
65
 
66
66
  - **Pure Ruby**: No external dependencies, C extensions, or C API calls.
67
- - **Lightweight**: Minimal performance impact, as tracing is only active during exception raising.
68
67
  - **Customizable Output**: Supports multiple output formats (`:json`, `:plaintext`, `:terminal`).
69
- - **Flexible Hooks**: Redact or modifying captured data via the `on_capture` hook.
68
+ - **Flexible Hooks**: Redact or modifying captured data via the `on_capture` hook. Update the final string with on_format.
70
69
  - **Environment-Based Defaults**: For Rails apps, automatically adjusts settings based on the environment (`development`, `test`, `production`, `ci`).
71
70
  - **Pre-Populated Skip List**: Comes with predefined skip lists to exclude irrelevant variables from being captured.
72
71
  - **Capture Levels**: Supports `info` and `debug` levels, where `debug` level ignores the skip lists for more comprehensive data capture.
73
72
  - **Capture Types**: Captures variables from the first `raise` and the last `rescue` for an exception by default.
74
73
  - **No dependencies**: EnhancedErrors does not ___require___ any dependencies--it uses [awesome_print](https://github.com/awesome-print/awesome_print) for nicer output if it is installed and available.
74
+ - **Lightweight**: Minimal performance impact, as tracing is only active during exception raising.
75
75
 
76
76
  EnhancedErrors has a few big use-cases:
77
77
 
@@ -79,20 +79,20 @@ EnhancedErrors has a few big use-cases:
79
79
  You also can't just print out all the data, because it's too big. You want to know what the data was the cause of the error.
80
80
  Ideally, without long instrument-re-run-fix loops. If your logging didn't capture the data, normally, you'd be stuck.
81
81
 
82
- * **Debug** a complex application erroring deep in the stack when you can't tell where the error originates
82
+ * **Debug** a complex application erroring deep in the stack when you can't tell where the error originates.
83
83
 
84
- * **Faster TDD** - Often, you won't have to re-run to see an error--you can go straight to the fix.
84
+ * **Reduce MTTR** Reduce mean time to resolution.
85
85
 
86
86
  * **Faster CI -> Fix loop**. When a bug happens in CI, usually there's a step where you first reproduce it locally.
87
87
  EnhancedErrors can help you skip that step.
88
88
 
89
- * **Faster debugging**. In general, you can skip the add-instrumentation step and jump to the fix.
89
+ * **Faster TDD**. In general, you can skip the add-instrumentation step and jump to the fix. Usually, you won't have to re-run to see an error.
90
90
 
91
91
  * **Heisenbugs** - bugs that disappear when you try to debug them. EnhancedErrors can help you capture the data that causes the bug before it disappears.
92
92
 
93
93
  * **Unknown Unknowns** - you can't pre-emptively log variables from failure cases you never imagined.
94
94
 
95
- * **Cron jobs** and **daemons** - when it fails for unknown reasons at 4am, check the log and fix--it probably has what you need.
95
+ * **Cron jobs** and **daemons** - when it fails for unknown reasons at 4am, check the log and fix--it probably has what you need. Note that
96
96
 
97
97
  ## Installation
98
98
 
@@ -266,6 +266,26 @@ end
266
266
  The skip list is pre-populated with common variables to exclude and can be extended based on your application's requirements.
267
267
 
268
268
 
269
+ #### Capture Rules
270
+
271
+ These exceptions are always ignored:
272
+
273
+ ```ruby
274
+ SystemExit,
275
+ NoMemoryError,
276
+ SignalException,
277
+ Interrupt,
278
+ ScriptError,
279
+ LoadError,
280
+ NotImplementedError,
281
+ SyntaxError,
282
+ SystemStackError
283
+ ```
284
+
285
+ While this is close to "Things that don't descend from StandardError", it's not exactly that.
286
+
287
+ In Info mode, variables starting with @_ are also ignored.
288
+
269
289
 
270
290
  ### Capture Levels
271
291
 
@@ -333,11 +353,38 @@ if you want to use it.
333
353
  gem 'awesome_print'
334
354
  ```
335
355
 
356
+ ## Alternatives
357
+
358
+ Why not use:
359
+
360
+ [binding_of_caller](https://github.com/banister/binding_of_caller) or [Pry](https://github.com/pry/pry) or [better_errors](https://github.com/BetterErrors/better_errors)?
361
+
362
+ First off, these gems are, I cannot stress this enough, a-m-a-z-i-n-g!!! I use them every day--kudos to their creators and maintainers!
363
+
364
+ This is intended for different use-cases. In sum, the goal of this gem is an every-day driver for __non-interactive__ variable inspection.
365
+
366
+ With EnhancedErrors is that I want extra details when I run into a problem I __didn't anticipate ahead of time__.
367
+ To make that work, it has to be able to safely be 'on' all the time, and it has to gather the data in
368
+ a way I naturally will see it without requiring extra preparation I obviously didn't know to do.
369
+
370
+ - That won't interrupt CI, but also, that lets me know what happened without reproduction
371
+ - That could, theoretically, also be fine in production (if data security, redaction, access, and encryption concerns were all addressed--Ok, big
372
+ list, but another option is to selectively enable targeted capture)
373
+ - Has decent performance characteristics
374
+ - **Only** becomes active in exception raise/rescue scenarios
375
+
376
+ This gem could have been implemented using binding_of_caller, or the gem it depends on, [debug_inspector](https://rubygems.org/gems/debug_inspector/versions/1.1.0?locale=en).
377
+ However, the recommendation is not to use those in production as they use C API extensions. This doesn't. This selectively uses
378
+ Ruby's TracePoint binding capture very narrowly with no other C API or dependencies, and only to target Exceptions--not to allow universal calls to the prior binding. It doesn't work as a debugger, but that also means it can, with care, operate safely in a narrow scope--becoming active only when exceptions are raised.
379
+
336
380
 
337
381
  ## Performance Considerations
338
382
 
339
- - **Minimal Overhead**: Since TracePoint is only activated during exception raising and rescuing, the performance impact is negligible during normal operation.
340
- - **Production Safe**: The gem is designed to be safe for production use, giving you valuable insights without compromising performance. Although this is the case, I'd still suggest letting it get well-vetted before making the leap.
383
+ - **Minimal Overhead**: Since TracePoint is only activated during exception raising and rescuing, the performance impact is negligible during normal operation. (Benchmark included)
384
+
385
+ - **TBD**: Memory considerations. This does capture data when an exception happens. EnhancedErrors hides under the bed when it sees **NoMemoryError**.
386
+
387
+ - **Goal: Production Safety**: The gem is designed to, once vetted, be safe for production use, giving you valuable insights without compromising performance. I suggest letting it get well-vetted before making the leap and testing it for both performance and memory under load internally, as well.
341
388
 
342
389
  ## Contributing
343
390
 
@@ -0,0 +1,78 @@
1
+ # benchmark_tracepoint.rb
2
+
3
+ def memory_usage
4
+ pid = Process.pid
5
+ `ps -o rss= -p #{pid}`.to_i # Returns memory usage in KB
6
+ end
7
+
8
+ # Generate a 100 MB string outside the iterations
9
+ large_string = 'a' * 10_000_000 # 10 million characters
10
+
11
+ def test_with_tracepoint(iterations, large_string)
12
+ puts "\nTest with TracePoint capturing bindings:"
13
+ captured_bindings = []
14
+
15
+ trace = TracePoint.new(:raise) do |tp|
16
+ captured_bindings << tp.binding
17
+ end
18
+
19
+ trace.enable
20
+
21
+ puts "Memory usage before exceptions: #{memory_usage} KB"
22
+
23
+ iterations.times do
24
+ begin
25
+ # Use the large string within the local scope
26
+ local_large_string = large_string
27
+ raise 'Test exception'
28
+ rescue => e
29
+ raise e rescue nil # Suppress the exception to continue the loop
30
+ end
31
+ end
32
+
33
+ puts "Memory usage after exceptions: #{memory_usage} KB"
34
+
35
+ trace.disable
36
+ end
37
+
38
+ def test_without_tracepoint(iterations, large_string)
39
+ puts "\nTest without TracePoint capturing bindings:"
40
+
41
+ puts "Memory usage before exceptions: #{memory_usage} KB"
42
+
43
+ iterations.times do
44
+ begin
45
+ # Use the large string within the local scope
46
+ local_large_string = large_string
47
+ raise 'Test exception'
48
+ rescue => e
49
+ raise e rescue nil
50
+ end
51
+ end
52
+
53
+ puts "Memory usage after exceptions: #{memory_usage} KB"
54
+ end
55
+
56
+ def test_exception_with_large_variable(iterations, large_string)
57
+ puts "\nTest with exceptions storing large variable:"
58
+
59
+ puts "Memory usage before exceptions: #{memory_usage} KB"
60
+
61
+ iterations.times do
62
+ begin
63
+ raise 'Test exception'
64
+ rescue => e
65
+ # Store a reference to the large string in the exception
66
+ e.instance_variable_set(:@large_string, large_string)
67
+ raise e rescue nil
68
+ end
69
+ end
70
+
71
+ puts "Memory usage after exceptions: #{memory_usage} KB"
72
+ end
73
+
74
+ iterations = 10 # Adjust iterations as needed
75
+
76
+ test_with_tracepoint(iterations, large_string)
77
+ test_without_tracepoint(iterations, large_string)
78
+ test_exception_with_large_variable(iterations, large_string)
data/doc/Binding.html CHANGED
@@ -127,7 +127,7 @@
127
127
  </div>
128
128
 
129
129
  <div id="footer">
130
- Generated on Fri Oct 25 11:07:02 2024 by
130
+ Generated on Sun Nov 10 12:01:14 2024 by
131
131
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
132
132
  0.9.37 (ruby-3.1.3).
133
133
  </div>
data/doc/Colors.html CHANGED
@@ -374,7 +374,7 @@
374
374
  </div>
375
375
 
376
376
  <div id="footer">
377
- Generated on Fri Oct 25 11:07:02 2024 by
377
+ Generated on Sun Nov 10 12:01:14 2024 by
378
378
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
379
379
  0.9.37 (ruby-3.1.3).
380
380
  </div>
data/doc/Debugging.html CHANGED
@@ -171,7 +171,7 @@
171
171
  </div>
172
172
 
173
173
  <div id="footer">
174
- Generated on Fri Oct 25 11:07:02 2024 by
174
+ Generated on Sun Nov 10 12:01:14 2024 by
175
175
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
176
176
  0.9.37 (ruby-3.1.3).
177
177
  </div>
@@ -906,12 +906,12 @@
906
906
  <pre class="lines">
907
907
 
908
908
 
909
- 41
910
- 42
911
- 43</pre>
909
+ 55
910
+ 56
911
+ 57</pre>
912
912
  </td>
913
913
  <td>
914
- <pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 41</span>
914
+ <pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 55</span>
915
915
 
916
916
  <span class='kw'>def</span> <span class='id identifier rubyid_capture_let_variables'>capture_let_variables</span>
917
917
  <span class='ivar'>@capture_let_variables</span>
@@ -962,12 +962,12 @@
962
962
  <pre class="lines">
963
963
 
964
964
 
965
- 26
966
- 27
967
- 28</pre>
965
+ 40
966
+ 41
967
+ 42</pre>
968
968
  </td>
969
969
  <td>
970
- <pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 26</span>
970
+ <pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 40</span>
971
971
 
972
972
  <span class='kw'>def</span> <span class='id identifier rubyid_config_block'>config_block</span>
973
973
  <span class='ivar'>@config_block</span>
@@ -1043,12 +1043,12 @@
1043
1043
  <pre class="lines">
1044
1044
 
1045
1045
 
1046
- 46
1047
- 47
1048
- 48</pre>
1046
+ 60
1047
+ 61
1048
+ 62</pre>
1049
1049
  </td>
1050
1050
  <td>
1051
- <pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 46</span>
1051
+ <pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 60</span>
1052
1052
 
1053
1053
  <span class='kw'>def</span> <span class='id identifier rubyid_eligible_for_capture'>eligible_for_capture</span>
1054
1054
  <span class='ivar'>@eligible_for_capture</span>
@@ -1099,12 +1099,12 @@
1099
1099
  <pre class="lines">
1100
1100
 
1101
1101
 
1102
- 16
1103
- 17
1104
- 18</pre>
1102
+ 30
1103
+ 31
1104
+ 32</pre>
1105
1105
  </td>
1106
1106
  <td>
1107
- <pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 16</span>
1107
+ <pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 30</span>
1108
1108
 
1109
1109
  <span class='kw'>def</span> <span class='id identifier rubyid_enabled'>enabled</span>
1110
1110
  <span class='ivar'>@enabled</span>
@@ -1182,12 +1182,12 @@
1182
1182
  <pre class="lines">
1183
1183
 
1184
1184
 
1185
- 31
1186
- 32
1187
- 33</pre>
1185
+ 45
1186
+ 46
1187
+ 47</pre>
1188
1188
  </td>
1189
1189
  <td>
1190
- <pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 31</span>
1190
+ <pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 45</span>
1191
1191
 
1192
1192
  <span class='kw'>def</span> <span class='id identifier rubyid_max_length'>max_length</span>
1193
1193
  <span class='ivar'>@max_length</span>
@@ -1238,12 +1238,12 @@
1238
1238
  <pre class="lines">
1239
1239
 
1240
1240
 
1241
- 36
1242
- 37
1243
- 38</pre>
1241
+ 50
1242
+ 51
1243
+ 52</pre>
1244
1244
  </td>
1245
1245
  <td>
1246
- <pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 36</span>
1246
+ <pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 50</span>
1247
1247
 
1248
1248
  <span class='kw'>def</span> <span class='id identifier rubyid_on_capture_hook'>on_capture_hook</span>
1249
1249
  <span class='ivar'>@on_capture_hook</span>
@@ -1299,12 +1299,12 @@
1299
1299
  <pre class="lines">
1300
1300
 
1301
1301
 
1302
- 51
1303
- 52
1304
- 53</pre>
1302
+ 65
1303
+ 66
1304
+ 67</pre>
1305
1305
  </td>
1306
1306
  <td>
1307
- <pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 51</span>
1307
+ <pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 65</span>
1308
1308
 
1309
1309
  <span class='kw'>def</span> <span class='id identifier rubyid_skip_list'>skip_list</span>
1310
1310
  <span class='ivar'>@skip_list</span>
@@ -1355,12 +1355,12 @@
1355
1355
  <pre class="lines">
1356
1356
 
1357
1357
 
1358
- 21
1359
- 22
1360
- 23</pre>
1358
+ 35
1359
+ 36
1360
+ 37</pre>
1361
1361
  </td>
1362
1362
  <td>
1363
- <pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 21</span>
1363
+ <pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 35</span>
1364
1364
 
1365
1365
  <span class='kw'>def</span> <span class='id identifier rubyid_trace'>trace</span>
1366
1366
  <span class='ivar'>@trace</span>
@@ -1441,12 +1441,12 @@
1441
1441
  <pre class="lines">
1442
1442
 
1443
1443
 
1444
- 139
1445
- 140
1446
- 141</pre>
1444
+ 153
1445
+ 154
1446
+ 155</pre>
1447
1447
  </td>
1448
1448
  <td>
1449
- <pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 139</span>
1449
+ <pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 153</span>
1450
1450
 
1451
1451
  <span class='kw'>def</span> <span class='id identifier rubyid_add_to_skip_list'>add_to_skip_list</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_vars'>vars</span><span class='rparen'>)</span>
1452
1452
  <span class='id identifier rubyid_skip_list'>skip_list</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_vars'>vars</span><span class='rparen'>)</span>
@@ -1520,23 +1520,23 @@
1520
1520
  <pre class="lines">
1521
1521
 
1522
1522
 
1523
- 313
1524
- 314
1525
- 315
1526
- 316
1527
- 317
1528
- 318
1529
- 319
1530
- 320
1531
- 321</pre>
1523
+ 327
1524
+ 328
1525
+ 329
1526
+ 330
1527
+ 331
1528
+ 332
1529
+ 333
1530
+ 334
1531
+ 335</pre>
1532
1532
  </td>
1533
1533
  <td>
1534
- <pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 313</span>
1534
+ <pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 327</span>
1535
1535
 
1536
1536
  <span class='kw'>def</span> <span class='id identifier rubyid_apply_skip_list'>apply_skip_list</span><span class='lparen'>(</span><span class='id identifier rubyid_binding_info'>binding_info</span><span class='rparen'>)</span>
1537
1537
  <span class='kw'>unless</span> <span class='ivar'>@debug</span>
1538
1538
  <span class='id identifier rubyid_variables'>variables</span> <span class='op'>=</span> <span class='id identifier rubyid_binding_info'>binding_info</span><span class='lbracket'>[</span><span class='symbol'>:variables</span><span class='rbracket'>]</span>
1539
- <span class='id identifier rubyid_variables'>variables</span><span class='lbracket'>[</span><span class='symbol'>:instances</span><span class='rbracket'>]</span><span class='op'>&amp;.</span><span class='id identifier rubyid_reject!'>reject!</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_var'>var</span><span class='comma'>,</span> <span class='id identifier rubyid__'>_</span><span class='op'>|</span> <span class='id identifier rubyid_skip_list'>skip_list</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_var'>var</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_var'>var</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_start_with?'>start_with?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>@__</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span> <span class='rbrace'>}</span>
1539
+ <span class='id identifier rubyid_variables'>variables</span><span class='lbracket'>[</span><span class='symbol'>:instances</span><span class='rbracket'>]</span><span class='op'>&amp;.</span><span class='id identifier rubyid_reject!'>reject!</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_var'>var</span><span class='comma'>,</span> <span class='id identifier rubyid__'>_</span><span class='op'>|</span> <span class='id identifier rubyid_skip_list'>skip_list</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_var'>var</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='lparen'>(</span><span class='id identifier rubyid_var'>var</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_start_with?'>start_with?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>@_</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='ivar'>@debug</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
1540
1540
  <span class='id identifier rubyid_variables'>variables</span><span class='lbracket'>[</span><span class='symbol'>:locals</span><span class='rbracket'>]</span><span class='op'>&amp;.</span><span class='id identifier rubyid_reject!'>reject!</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_var'>var</span><span class='comma'>,</span> <span class='id identifier rubyid__'>_</span><span class='op'>|</span> <span class='id identifier rubyid_skip_list'>skip_list</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_var'>var</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
1541
1541
  <span class='id identifier rubyid_variables'>variables</span><span class='lbracket'>[</span><span class='symbol'>:globals</span><span class='rbracket'>]</span><span class='op'>&amp;.</span><span class='id identifier rubyid_reject!'>reject!</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_var'>var</span><span class='comma'>,</span> <span class='id identifier rubyid__'>_</span><span class='op'>|</span> <span class='id identifier rubyid_skip_list'>skip_list</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_var'>var</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
1542
1542
  <span class='kw'>end</span>
@@ -1611,20 +1611,6 @@
1611
1611
  <pre class="lines">
1612
1612
 
1613
1613
 
1614
- 339
1615
- 340
1616
- 341
1617
- 342
1618
- 343
1619
- 344
1620
- 345
1621
- 346
1622
- 347
1623
- 348
1624
- 349
1625
- 350
1626
- 351
1627
- 352
1628
1614
  353
1629
1615
  354
1630
1616
  355
@@ -1642,10 +1628,28 @@
1642
1628
  367
1643
1629
  368
1644
1630
  369
1645
- 370</pre>
1631
+ 370
1632
+ 371
1633
+ 372
1634
+ 373
1635
+ 374
1636
+ 375
1637
+ 376
1638
+ 377
1639
+ 378
1640
+ 379
1641
+ 380
1642
+ 381
1643
+ 382
1644
+ 383
1645
+ 384
1646
+ 385
1647
+ 386
1648
+ 387
1649
+ 388</pre>
1646
1650
  </td>
1647
1651
  <td>
1648
- <pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 339</span>
1652
+ <pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 353</span>
1649
1653
 
1650
1654
  <span class='kw'>def</span> <span class='id identifier rubyid_binding_info_string'>binding_info_string</span><span class='lparen'>(</span><span class='id identifier rubyid_binding_info'>binding_info</span><span class='rparen'>)</span>
1651
1655
  <span class='id identifier rubyid_capture_event'>capture_event</span> <span class='op'>=</span> <span class='id identifier rubyid_binding_info'>binding_info</span><span class='lbracket'>[</span><span class='symbol'>:capture_event</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_capitalize'>capitalize</span>
@@ -1661,7 +1665,6 @@
1661
1665
 
1662
1666
  <span class='id identifier rubyid_instance_vars_to_display'>instance_vars_to_display</span> <span class='op'>=</span> <span class='id identifier rubyid_variables'>variables</span><span class='lbracket'>[</span><span class='symbol'>:instances</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
1663
1667
 
1664
-
1665
1668
  <span class='kw'>if</span> <span class='id identifier rubyid_instance_vars_to_display'>instance_vars_to_display</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='id identifier rubyid_instance_vars_to_display'>instance_vars_to_display</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
1666
1669
  <span class='id identifier rubyid_result'>result</span> <span class='op'>+=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\n</span><span class='embexpr_beg'>#{</span><span class='const'><span class='object_link'><a href="Colors.html" title="Colors (class)">Colors</a></span></span><span class='period'>.</span><span class='id identifier rubyid_green'>green</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Instances:</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>\n</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_variable_description'>variable_description</span><span class='lparen'>(</span><span class='id identifier rubyid_instance_vars_to_display'>instance_vars_to_display</span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
1667
1670
  <span class='kw'>end</span>
@@ -1678,6 +1681,11 @@
1678
1681
  <span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='id identifier rubyid_result'>result</span><span class='lbracket'>[</span><span class='int'>0</span><span class='op'>...</span><span class='id identifier rubyid_max_length'>max_length</span><span class='rbracket'>]</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>... (truncated)</span><span class='tstring_end'>&quot;</span></span>
1679
1682
  <span class='kw'>end</span>
1680
1683
  <span class='id identifier rubyid_result'>result</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\n</span><span class='tstring_end'>&quot;</span></span>
1684
+ <span class='kw'>rescue</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span>
1685
+ <span class='comment'># we swallow and don&#39;t re-raise to avoid any recursion problems. We don&#39;t want to
1686
+ </span> <span class='comment'># mess up the original exception handling.
1687
+ </span> <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>EnhancedErrors error in binding_info_string: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_backtrace'>backtrace</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
1688
+ <span class='kw'>return</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span>
1681
1689
  <span class='kw'>end</span></pre>
1682
1690
  </td>
1683
1691
  </tr>
@@ -1766,25 +1774,25 @@
1766
1774
  <pre class="lines">
1767
1775
 
1768
1776
 
1769
- 255
1770
- 256
1771
- 257
1772
- 258
1773
- 259
1774
- 260
1775
- 261
1776
- 262
1777
- 263
1778
- 264
1779
- 265
1780
- 266
1781
- 267
1782
- 268
1783
1777
  269
1784
- 270</pre>
1778
+ 270
1779
+ 271
1780
+ 272
1781
+ 273
1782
+ 274
1783
+ 275
1784
+ 276
1785
+ 277
1786
+ 278
1787
+ 279
1788
+ 280
1789
+ 281
1790
+ 282
1791
+ 283
1792
+ 284</pre>
1785
1793
  </td>
1786
1794
  <td>
1787
- <pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 255</span>
1795
+ <pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 269</span>
1788
1796
 
1789
1797
  <span class='kw'>def</span> <span class='id identifier rubyid_binding_infos_array_to_string'>binding_infos_array_to_string</span><span class='lparen'>(</span><span class='id identifier rubyid_captured_bindings'>captured_bindings</span><span class='comma'>,</span> <span class='id identifier rubyid_format'>format</span> <span class='op'>=</span> <span class='symbol'>:terminal</span><span class='rparen'>)</span>
1790
1798
  <span class='kw'>case</span> <span class='id identifier rubyid_format'>format</span>
@@ -1851,12 +1859,12 @@
1851
1859
  <pre class="lines">
1852
1860
 
1853
1861
 
1854
- 131
1855
- 132
1856
- 133</pre>
1862
+ 145
1863
+ 146
1864
+ 147</pre>
1857
1865
  </td>
1858
1866
  <td>
1859
- <pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 131</span>
1867
+ <pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 145</span>
1860
1868
 
1861
1869
  <span class='kw'>def</span> <span class='id identifier rubyid_default_skip_list'>default_skip_list</span>
1862
1870
  <span class='const'>Set</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="#RAILS_SKIP_LIST-constant" title="EnhancedErrors::RAILS_SKIP_LIST (constant)">RAILS_SKIP_LIST</a></span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="#RSPEC_SKIP_LIST-constant" title="EnhancedErrors::RSPEC_SKIP_LIST (constant)">RSPEC_SKIP_LIST</a></span></span><span class='rparen'>)</span>
@@ -1966,20 +1974,6 @@
1966
1974
  <pre class="lines">
1967
1975
 
1968
1976
 
1969
- 150
1970
- 151
1971
- 152
1972
- 153
1973
- 154
1974
- 155
1975
- 156
1976
- 157
1977
- 158
1978
- 159
1979
- 160
1980
- 161
1981
- 162
1982
- 163
1983
1977
  164
1984
1978
  165
1985
1979
  166
@@ -1997,10 +1991,24 @@
1997
1991
  178
1998
1992
  179
1999
1993
  180
2000
- 181</pre>
1994
+ 181
1995
+ 182
1996
+ 183
1997
+ 184
1998
+ 185
1999
+ 186
2000
+ 187
2001
+ 188
2002
+ 189
2003
+ 190
2004
+ 191
2005
+ 192
2006
+ 193
2007
+ 194
2008
+ 195</pre>
2001
2009
  </td>
2002
2010
  <td>
2003
- <pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 150</span>
2011
+ <pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 164</span>
2004
2012
 
2005
2013
  <span class='kw'>def</span> <span class='id identifier rubyid_enhance!'>enhance!</span><span class='lparen'>(</span><span class='label'>enabled:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>debug:</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='label'>capture_events:</span> <span class='id identifier rubyid_default_capture_events'>default_capture_events</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
2006
2014
  <span class='id identifier rubyid_capture_events'>capture_events</span> <span class='op'>=</span> <span class='const'>Array</span><span class='lparen'>(</span><span class='id identifier rubyid_capture_events'>capture_events</span><span class='rparen'>)</span>
@@ -2123,18 +2131,18 @@
2123
2131
  <pre class="lines">
2124
2132
 
2125
2133
 
2126
- 240
2127
- 241
2128
- 242
2129
- 243
2130
- 244
2131
- 245
2132
- 246
2133
- 247
2134
- 248</pre>
2134
+ 254
2135
+ 255
2136
+ 256
2137
+ 257
2138
+ 258
2139
+ 259
2140
+ 260
2141
+ 261
2142
+ 262</pre>
2135
2143
  </td>
2136
2144
  <td>
2137
- <pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 240</span>
2145
+ <pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 254</span>
2138
2146
 
2139
2147
  <span class='kw'>def</span> <span class='id identifier rubyid_format'>format</span><span class='lparen'>(</span><span class='id identifier rubyid_captured_bindings'>captured_bindings</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_output_format'>output_format</span> <span class='op'>=</span> <span class='id identifier rubyid_get_default_format_for_environment'>get_default_format_for_environment</span><span class='rparen'>)</span>
2140
2148
  <span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='id identifier rubyid_binding_infos_array_to_string'>binding_infos_array_to_string</span><span class='lparen'>(</span><span class='id identifier rubyid_captured_bindings'>captured_bindings</span><span class='comma'>,</span> <span class='id identifier rubyid_output_format'>output_format</span><span class='rparen'>)</span>
@@ -2194,25 +2202,25 @@
2194
2202
  <pre class="lines">
2195
2203
 
2196
2204
 
2197
- 275
2198
- 276
2199
- 277
2200
- 278
2201
- 279
2202
- 280
2203
- 281
2204
- 282
2205
- 283
2206
- 284
2207
- 285
2208
- 286
2209
- 287
2210
- 288
2211
2205
  289
2212
- 290</pre>
2206
+ 290
2207
+ 291
2208
+ 292
2209
+ 293
2210
+ 294
2211
+ 295
2212
+ 296
2213
+ 297
2214
+ 298
2215
+ 299
2216
+ 300
2217
+ 301
2218
+ 302
2219
+ 303
2220
+ 304</pre>
2213
2221
  </td>
2214
2222
  <td>
2215
- <pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 275</span>
2223
+ <pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 289</span>
2216
2224
 
2217
2225
  <span class='kw'>def</span> <span class='id identifier rubyid_get_default_format_for_environment'>get_default_format_for_environment</span>
2218
2226
  <span class='kw'>return</span> <span class='ivar'>@output_format</span> <span class='kw'>unless</span> <span class='ivar'>@output_format</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
@@ -2299,16 +2307,16 @@
2299
2307
  <pre class="lines">
2300
2308
 
2301
2309
 
2302
- 199
2303
- 200
2304
- 201
2305
- 202
2306
- 203
2307
- 204
2308
- 205</pre>
2310
+ 213
2311
+ 214
2312
+ 215
2313
+ 216
2314
+ 217
2315
+ 218
2316
+ 219</pre>
2309
2317
  </td>
2310
2318
  <td>
2311
- <pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 199</span>
2319
+ <pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 213</span>
2312
2320
 
2313
2321
  <span class='kw'>def</span> <span class='id identifier rubyid_on_capture'>on_capture</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
2314
2322
  <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
@@ -2386,12 +2394,12 @@
2386
2394
  <pre class="lines">
2387
2395
 
2388
2396
 
2389
- 211
2390
- 212
2391
- 213</pre>
2397
+ 225
2398
+ 226
2399
+ 227</pre>
2392
2400
  </td>
2393
2401
  <td>
2394
- <pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 211</span>
2402
+ <pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 225</span>
2395
2403
 
2396
2404
  <span class='kw'>def</span> <span class='id identifier rubyid_on_capture='>on_capture=</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
2397
2405
  <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_on_capture_hook'>on_capture_hook</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span>
@@ -2465,16 +2473,16 @@
2465
2473
  <pre class="lines">
2466
2474
 
2467
2475
 
2468
- 219
2469
- 220
2470
- 221
2471
- 222
2472
- 223
2473
- 224
2474
- 225</pre>
2476
+ 233
2477
+ 234
2478
+ 235
2479
+ 236
2480
+ 237
2481
+ 238
2482
+ 239</pre>
2475
2483
  </td>
2476
2484
  <td>
2477
- <pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 219</span>
2485
+ <pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 233</span>
2478
2486
 
2479
2487
  <span class='kw'>def</span> <span class='id identifier rubyid_on_format'>on_format</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
2480
2488
  <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
@@ -2552,12 +2560,12 @@
2552
2560
  <pre class="lines">
2553
2561
 
2554
2562
 
2555
- 231
2556
- 232
2557
- 233</pre>
2563
+ 245
2564
+ 246
2565
+ 247</pre>
2558
2566
  </td>
2559
2567
  <td>
2560
- <pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 231</span>
2568
+ <pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 245</span>
2561
2569
 
2562
2570
  <span class='kw'>def</span> <span class='id identifier rubyid_on_format='>on_format=</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
2563
2571
  <span class='ivar'>@on_format_hook</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span>
@@ -2611,22 +2619,22 @@
2611
2619
  <pre class="lines">
2612
2620
 
2613
2621
 
2614
- 295
2615
- 296
2616
- 297
2617
- 298
2618
- 299
2619
- 300
2620
- 301
2621
- 302
2622
- 303
2623
- 304
2624
- 305
2625
- 306
2626
- 307</pre>
2622
+ 309
2623
+ 310
2624
+ 311
2625
+ 312
2626
+ 313
2627
+ 314
2628
+ 315
2629
+ 316
2630
+ 317
2631
+ 318
2632
+ 319
2633
+ 320
2634
+ 321</pre>
2627
2635
  </td>
2628
2636
  <td>
2629
- <pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 295</span>
2637
+ <pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 309</span>
2630
2638
 
2631
2639
  <span class='kw'>def</span> <span class='id identifier rubyid_running_in_ci?'>running_in_ci?</span>
2632
2640
  <span class='kw'>return</span> <span class='ivar'>@running_in_ci</span> <span class='kw'>if</span> <span class='kw'>defined?</span><span class='lparen'>(</span><span class='ivar'>@running_in_ci</span><span class='rparen'>)</span>
@@ -2710,16 +2718,16 @@
2710
2718
  <pre class="lines">
2711
2719
 
2712
2720
 
2713
- 327
2714
- 328
2715
- 329
2716
- 330
2717
- 331
2718
- 332
2719
- 333</pre>
2721
+ 341
2722
+ 342
2723
+ 343
2724
+ 344
2725
+ 345
2726
+ 346
2727
+ 347</pre>
2720
2728
  </td>
2721
2729
  <td>
2722
- <pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 327</span>
2730
+ <pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 341</span>
2723
2731
 
2724
2732
  <span class='kw'>def</span> <span class='id identifier rubyid_validate_binding_format'>validate_binding_format</span><span class='lparen'>(</span><span class='id identifier rubyid_binding_info'>binding_info</span><span class='rparen'>)</span>
2725
2733
  <span class='kw'>unless</span> <span class='id identifier rubyid_binding_info'>binding_info</span><span class='period'>.</span><span class='id identifier rubyid_keys'>keys</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='symbol'>:capture_event</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_binding_info'>binding_info</span><span class='lbracket'>[</span><span class='symbol'>:variables</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Hash</span><span class='rparen'>)</span>
@@ -2738,7 +2746,7 @@
2738
2746
  </div>
2739
2747
 
2740
2748
  <div id="footer">
2741
- Generated on Fri Oct 25 11:07:02 2024 by
2749
+ Generated on Sun Nov 10 12:01:14 2024 by
2742
2750
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
2743
2751
  0.9.37 (ruby-3.1.3).
2744
2752
  </div>
@@ -172,16 +172,22 @@
172
172
  5
173
173
  6
174
174
  7
175
- 8</pre>
175
+ 8
176
+ 9
177
+ 10
178
+ 11</pre>
176
179
  </td>
177
180
  <td>
178
181
  <pre class="code"><span class="info file"># File 'lib/error_enhancements.rb', line 2</span>
179
182
 
180
183
  <span class='kw'>def</span> <span class='id identifier rubyid_message'>message</span>
181
184
  <span class='id identifier rubyid_original_message'>original_message</span> <span class='op'>=</span> <span class='kw'>super</span><span class='lparen'>(</span><span class='rparen'>)</span>
182
- <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_original_message'>original_message</span><span class='embexpr_end'>}</span><span class='tstring_content'>\n</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_variables_message'>variables_message</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
185
+ <span class='kw'>if</span> <span class='id identifier rubyid_original_message'>original_message</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_variables_message'>variables_message</span><span class='rparen'>)</span>
186
+ <span class='id identifier rubyid_original_message'>original_message</span>
187
+ <span class='kw'>else</span>
188
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_original_message'>original_message</span><span class='embexpr_end'>}</span><span class='tstring_content'>\n</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_variables_message'>variables_message</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
189
+ <span class='kw'>end</span>
183
190
  <span class='kw'>rescue</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span>
184
- <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Error in message method: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
185
191
  <span class='id identifier rubyid_original_message'>original_message</span>
186
192
  <span class='kw'>end</span></pre>
187
193
  </td>
@@ -204,9 +210,6 @@
204
210
  <pre class="lines">
205
211
 
206
212
 
207
- 10
208
- 11
209
- 12
210
213
  13
211
214
  14
212
215
  15
@@ -215,10 +218,13 @@
215
218
  18
216
219
  19
217
220
  20
218
- 21</pre>
221
+ 21
222
+ 22
223
+ 23
224
+ 24</pre>
219
225
  </td>
220
226
  <td>
221
- <pre class="code"><span class="info file"># File 'lib/error_enhancements.rb', line 10</span>
227
+ <pre class="code"><span class="info file"># File 'lib/error_enhancements.rb', line 13</span>
222
228
 
223
229
  <span class='kw'>def</span> <span class='id identifier rubyid_variables_message'>variables_message</span>
224
230
  <span class='ivar'>@variables_message</span> <span class='op'>||=</span> <span class='kw'>begin</span>
@@ -242,7 +248,7 @@
242
248
  </div>
243
249
 
244
250
  <div id="footer">
245
- Generated on Fri Oct 25 11:07:02 2024 by
251
+ Generated on Sun Nov 10 12:01:14 2024 by
246
252
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
247
253
  0.9.37 (ruby-3.1.3).
248
254
  </div>
data/doc/_index.html CHANGED
@@ -141,7 +141,7 @@
141
141
  </div>
142
142
 
143
143
  <div id="footer">
144
- Generated on Fri Oct 25 11:07:01 2024 by
144
+ Generated on Sun Nov 10 12:01:13 2024 by
145
145
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
146
146
  0.9.37 (ruby-3.1.3).
147
147
  </div>
data/doc/file.README.html CHANGED
@@ -314,6 +314,25 @@
314
314
 
315
315
  <p>The skip list is pre-populated with common variables to exclude and can be extended based on your application’s requirements.</p>
316
316
 
317
+ <h4 id="label-Capture+Rules">Capture Rules</h4>
318
+
319
+ <p>These exceptions are always ignored:</p>
320
+
321
+ <pre class="code ruby"><code class="ruby">SystemExit,
322
+ NoMemoryError,
323
+ SignalException,
324
+ Interrupt,
325
+ ScriptError,
326
+ LoadError,
327
+ NotImplementedError,
328
+ SyntaxError,
329
+ SystemStackError
330
+ </code></pre>
331
+
332
+ <p>While this is close to “Things that don’t descend from StandardError”, it’s not exactly that.</p>
333
+
334
+ <p>In Info mode, variables starting with @_ are also ignored.</p>
335
+
317
336
  <h3 id="label-Capture+Levels">Capture Levels</h3>
318
337
 
319
338
  <p>EnhancedErrors supports different capture levels to control the verbosity of the captured data:</p>
@@ -392,7 +411,7 @@
392
411
  </div></div>
393
412
 
394
413
  <div id="footer">
395
- Generated on Fri Oct 25 11:07:02 2024 by
414
+ Generated on Sun Nov 10 12:01:13 2024 by
396
415
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
397
416
  0.9.37 (ruby-3.1.3).
398
417
  </div>
data/doc/index.html CHANGED
@@ -314,6 +314,25 @@
314
314
 
315
315
  <p>The skip list is pre-populated with common variables to exclude and can be extended based on your application’s requirements.</p>
316
316
 
317
+ <h4 id="label-Capture+Rules">Capture Rules</h4>
318
+
319
+ <p>These exceptions are always ignored:</p>
320
+
321
+ <pre class="code ruby"><code class="ruby">SystemExit,
322
+ NoMemoryError,
323
+ SignalException,
324
+ Interrupt,
325
+ ScriptError,
326
+ LoadError,
327
+ NotImplementedError,
328
+ SyntaxError,
329
+ SystemStackError
330
+ </code></pre>
331
+
332
+ <p>While this is close to “Things that don’t descend from StandardError”, it’s not exactly that.</p>
333
+
334
+ <p>In Info mode, variables starting with @_ are also ignored.</p>
335
+
317
336
  <h3 id="label-Capture+Levels">Capture Levels</h3>
318
337
 
319
338
  <p>EnhancedErrors supports different capture levels to control the verbosity of the captured data:</p>
@@ -392,7 +411,7 @@
392
411
  </div></div>
393
412
 
394
413
  <div id="footer">
395
- Generated on Fri Oct 25 11:07:02 2024 by
414
+ Generated on Sun Nov 10 12:01:13 2024 by
396
415
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
397
416
  0.9.37 (ruby-3.1.3).
398
417
  </div>
@@ -91,6 +91,43 @@
91
91
 
92
92
  </p>
93
93
 
94
+
95
+ <h2>
96
+ Constant Summary
97
+ <small><a href="#" class="constants_summary_toggle">collapse</a></small>
98
+ </h2>
99
+
100
+ <dl class="constants">
101
+
102
+ <dt id="IGNORED_EXCEPTIONS-constant" class="">IGNORED_EXCEPTIONS =
103
+ <div class="docstring">
104
+ <div class="discussion">
105
+
106
+ <p>While we could just catch StandardError, we would miss a number of things.</p>
107
+
108
+
109
+ </div>
110
+ </div>
111
+ <div class="tags">
112
+
113
+
114
+ </div>
115
+ </dt>
116
+ <dd><pre class="code"><span class='lbracket'>[</span>
117
+ <span class='const'>SystemExit</span><span class='comma'>,</span>
118
+ <span class='const'>NoMemoryError</span><span class='comma'>,</span>
119
+ <span class='const'>SignalException</span><span class='comma'>,</span>
120
+ <span class='const'>Interrupt</span><span class='comma'>,</span>
121
+ <span class='const'>ScriptError</span><span class='comma'>,</span>
122
+ <span class='const'>LoadError</span><span class='comma'>,</span>
123
+ <span class='const'>NotImplementedError</span><span class='comma'>,</span>
124
+ <span class='const'>SyntaxError</span><span class='comma'>,</span>
125
+ <span class='const'>SystemStackError</span>
126
+ <span class='rbracket'>]</span></pre></dd>
127
+
128
+ </dl>
129
+
130
+
94
131
 
95
132
 
96
133
 
@@ -102,7 +139,7 @@
102
139
  </div>
103
140
 
104
141
  <div id="footer">
105
- Generated on Fri Oct 25 11:07:02 2024 by
142
+ Generated on Sun Nov 10 12:01:14 2024 by
106
143
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
107
144
  0.9.37 (ruby-3.1.3).
108
145
  </div>
@@ -1,10 +1,10 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "enhanced_errors"
3
- spec.version = "0.1.5"
3
+ spec.version = "0.1.6"
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."
7
- spec.description = "With no extra dependencies, and using only Ruby's built-in TracePoint, EnhancedErrors will automatically enhance your errors with messages containing variable values from the moment they were raised."
7
+ spec.description = "EnhancedErrors will automatically enhance your errors with messages containing variable values from the moment they were raised, using no extra dependencies, and only Ruby's built-in TracePoint. "
8
8
  spec.homepage = "https://github.com/ericbeland/enhanced_errors"
9
9
  spec.required_ruby_version = ">= 3.0.0"
10
10
 
@@ -5,6 +5,20 @@ require_relative 'colors'
5
5
  require_relative 'error_enhancements'
6
6
  require_relative 'binding'
7
7
 
8
+ # While we could just catch StandardError, we would miss a number of things.
9
+
10
+ IGNORED_EXCEPTIONS = [
11
+ SystemExit,
12
+ NoMemoryError,
13
+ SignalException,
14
+ Interrupt,
15
+ ScriptError,
16
+ LoadError,
17
+ NotImplementedError,
18
+ SyntaxError,
19
+ SystemStackError
20
+ ]
21
+
8
22
  # The EnhancedErrors class provides mechanisms to enhance exception handling by capturing
9
23
  # additional context such as binding information, variables, and method arguments when exceptions are raised.
10
24
  # It offers customization options for formatting and filtering captured data.
@@ -313,7 +327,7 @@ class EnhancedErrors
313
327
  def apply_skip_list(binding_info)
314
328
  unless @debug
315
329
  variables = binding_info[:variables]
316
- variables[:instances]&.reject! { |var, _| skip_list.include?(var) || var.to_s.start_with?('@__') }
330
+ variables[:instances]&.reject! { |var, _| skip_list.include?(var) || (var.to_s.start_with?('@_') && !@debug) }
317
331
  variables[:locals]&.reject! { |var, _| skip_list.include?(var) }
318
332
  variables[:globals]&.reject! { |var, _| skip_list.include?(var) }
319
333
  end
@@ -350,7 +364,6 @@ class EnhancedErrors
350
364
 
351
365
  instance_vars_to_display = variables[:instances] || {}
352
366
 
353
-
354
367
  if instance_vars_to_display && !instance_vars_to_display.empty?
355
368
  result += "\n#{Colors.green('Instances:')}\n#{variable_description(instance_vars_to_display)}"
356
369
  end
@@ -367,6 +380,11 @@ class EnhancedErrors
367
380
  result = result[0...max_length] + "... (truncated)"
368
381
  end
369
382
  result + "\n"
383
+ rescue => e
384
+ # we swallow and don't re-raise to avoid any recursion problems. We don't want to
385
+ # mess up the original exception handling.
386
+ puts "EnhancedErrors error in binding_info_string: #{e.message} #{e.backtrace}"
387
+ return ''
370
388
  end
371
389
 
372
390
  private
@@ -380,7 +398,7 @@ class EnhancedErrors
380
398
  events = @capture_events ? @capture_events.to_a : [:raise]
381
399
 
382
400
  @trace = TracePoint.new(*events) do |tp|
383
- next if Thread.current[:enhanced_errors_processing] || tp.raised_exception.is_a?(NoMemoryError)
401
+ next if Thread.current[:enhanced_errors_processing] || IGNORED_EXCEPTIONS.include?(tp.raised_exception)
384
402
  Thread.current[:enhanced_errors_processing] = true
385
403
  exception = tp.raised_exception
386
404
  capture_me = EnhancedErrors.eligible_for_capture.call(exception)
@@ -597,6 +615,8 @@ class EnhancedErrors
597
615
  # @return [String] The formatted variable.
598
616
  def format_variable(variable)
599
617
  (awesome_print_available? && Colors.enabled?) ? variable.ai : variable.inspect
618
+ rescue => e
619
+ return "#{variable.to_s.truncate(30)}: [Inspection Error]"
600
620
  end
601
621
 
602
622
  # Checks if the `AwesomePrint` gem is available.
@@ -1,9 +1,12 @@
1
1
  module ErrorEnhancements
2
2
  def message
3
3
  original_message = super()
4
- "#{original_message}\n#{variables_message}"
4
+ if original_message.include?(variables_message)
5
+ original_message
6
+ else
7
+ "#{original_message}\n#{variables_message}"
8
+ end
5
9
  rescue => e
6
- puts "Error in message method: #{e.message}"
7
10
  original_message
8
11
  end
9
12
 
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.5
4
+ version: 0.1.6
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-25 00:00:00.000000000 Z
11
+ date: 2024-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: awesome_print
@@ -52,9 +52,9 @@ dependencies:
52
52
  - - ">"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0.9'
55
- description: With no extra dependencies, and using only Ruby's built-in TracePoint,
56
- EnhancedErrors will automatically enhance your errors with messages containing variable
57
- values from the moment they were raised.
55
+ description: 'EnhancedErrors will automatically enhance your errors with messages
56
+ containing variable values from the moment they were raised, using no extra dependencies,
57
+ and only Ruby''s built-in TracePoint. '
58
58
  email:
59
59
  executables: []
60
60
  extensions: []
@@ -68,6 +68,7 @@ files:
68
68
  - LICENSE
69
69
  - README.md
70
70
  - benchmark/benchmark.rb
71
+ - benchmark/memory_bench.rb
71
72
  - benchmark/stackprofile.rb
72
73
  - doc/Binding.html
73
74
  - doc/Colors.html