enhanced_errors 3.0.1 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -387,7 +387,7 @@
387
387
  </div>
388
388
 
389
389
  <div id="footer">
390
- Generated on Tue Dec 17 15:42:48 2024 by
390
+ Generated on Tue Dec 17 21:43:58 2024 by
391
391
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
392
392
  0.9.37 (ruby-3.3.6).
393
393
  </div>
data/doc/Exception.html CHANGED
@@ -111,7 +111,7 @@
111
111
  </div>
112
112
 
113
113
  <div id="footer">
114
- Generated on Tue Dec 17 15:42:48 2024 by
114
+ Generated on Tue Dec 17 21:43:58 2024 by
115
115
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
116
116
  0.9.37 (ruby-3.3.6).
117
117
  </div>
@@ -245,7 +245,7 @@
245
245
  </div>
246
246
 
247
247
  <div id="footer">
248
- Generated on Tue Dec 17 15:42:48 2024 by
248
+ Generated on Tue Dec 17 21:43:58 2024 by
249
249
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
250
250
  0.9.37 (ruby-3.3.6).
251
251
  </div>
data/doc/Minitest.html CHANGED
@@ -202,7 +202,8 @@
202
202
  12
203
203
  13
204
204
  14
205
- 15</pre>
205
+ 15
206
+ 16</pre>
206
207
  </td>
207
208
  <td>
208
209
  <pre class="code"><span class="info file"># File 'lib/enhanced/minitest_patch.rb', line 5</span>
@@ -214,6 +215,7 @@
214
215
  <span class='kw'>begin</span>
215
216
  <span class='id identifier rubyid_binding_infos'>binding_infos</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="EnhancedErrors.html" title="EnhancedErrors (class)">EnhancedErrors</a></span></span><span class='period'>.</span><span class='id identifier rubyid_stop_minitest_binding_capture'><span class='object_link'><a href="EnhancedErrors.html#stop_minitest_binding_capture-class_method" title="EnhancedErrors.stop_minitest_binding_capture (method)">stop_minitest_binding_capture</a></span></span>
216
217
  <span class='const'><span class='object_link'><a href="EnhancedErrors.html" title="EnhancedErrors (class)">EnhancedErrors</a></span></span><span class='period'>.</span><span class='id identifier rubyid_override_exception_message'><span class='object_link'><a href="EnhancedErrors.html#override_exception_message-class_method" title="EnhancedErrors.override_exception_message (method)">override_exception_message</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_result'>result</span><span class='period'>.</span><span class='id identifier rubyid_failures'>failures</span><span class='period'>.</span><span class='id identifier rubyid_last'>last</span><span class='comma'>,</span> <span class='id identifier rubyid_binding_infos'>binding_infos</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_result'>result</span><span class='period'>.</span><span class='id identifier rubyid_failures'>failures</span><span class='period'>.</span><span class='id identifier rubyid_any?'>any?</span>
218
+ <span class='const'><span class='object_link'><a href="EnhancedExceptionContext.html" title="EnhancedExceptionContext (module)">EnhancedExceptionContext</a></span></span><span class='period'>.</span><span class='id identifier rubyid_clear_all'><span class='object_link'><a href="EnhancedExceptionContext.html#clear_all-instance_method" title="EnhancedExceptionContext#clear_all (method)">clear_all</a></span></span>
217
219
  <span class='kw'>rescue</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span>
218
220
  <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Ignored error during error enhancement: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_e'>e</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
219
221
  <span class='kw'>end</span>
@@ -228,7 +230,7 @@
228
230
  </div>
229
231
 
230
232
  <div id="footer">
231
- Generated on Tue Dec 17 15:42:48 2024 by
233
+ Generated on Tue Dec 17 21:43:58 2024 by
232
234
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
233
235
  0.9.37 (ruby-3.3.6).
234
236
  </div>
data/doc/_index.html CHANGED
@@ -150,7 +150,7 @@
150
150
  </div>
151
151
 
152
152
  <div id="footer">
153
- Generated on Tue Dec 17 15:42:48 2024 by
153
+ Generated on Tue Dec 17 21:43:58 2024 by
154
154
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
155
155
  0.9.37 (ruby-3.3.6).
156
156
  </div>
data/doc/file.README.html CHANGED
@@ -486,7 +486,7 @@
486
486
  </div></div>
487
487
 
488
488
  <div id="footer">
489
- Generated on Tue Dec 17 15:42:48 2024 by
489
+ Generated on Tue Dec 17 21:43:58 2024 by
490
490
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
491
491
  0.9.37 (ruby-3.3.6).
492
492
  </div>
data/doc/index.html CHANGED
@@ -486,7 +486,7 @@
486
486
  </div></div>
487
487
 
488
488
  <div id="footer">
489
- Generated on Tue Dec 17 15:42:48 2024 by
489
+ Generated on Tue Dec 17 21:43:58 2024 by
490
490
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
491
491
  0.9.37 (ruby-3.3.6).
492
492
  </div>
data/doc/method_list.html CHANGED
@@ -96,30 +96,6 @@
96
96
 
97
97
 
98
98
  <li class="odd ">
99
- <div class="item">
100
- <span class='object_link'><a href="EnhancedErrors.html#capture_events_count-class_method" title="EnhancedErrors.capture_events_count (method)">capture_events_count</a></span>
101
- <small>EnhancedErrors</small>
102
- </div>
103
- </li>
104
-
105
-
106
- <li class="even ">
107
- <div class="item">
108
- <span class='object_link'><a href="EnhancedErrors.html#capture_events_count=-class_method" title="EnhancedErrors.capture_events_count= (method)">capture_events_count=</a></span>
109
- <small>EnhancedErrors</small>
110
- </div>
111
- </li>
112
-
113
-
114
- <li class="odd ">
115
- <div class="item">
116
- <span class='object_link'><a href="EnhancedErrors.html#capture_limit_exceeded%3F-class_method" title="EnhancedErrors.capture_limit_exceeded? (method)">capture_limit_exceeded?</a></span>
117
- <small>EnhancedErrors</small>
118
- </div>
119
- </li>
120
-
121
-
122
- <li class="even ">
123
99
  <div class="item">
124
100
  <span class='object_link'><a href="EnhancedErrors.html#capture_rescue-class_method" title="EnhancedErrors.capture_rescue (method)">capture_rescue</a></span>
125
101
  <small>EnhancedErrors</small>
@@ -127,7 +103,7 @@
127
103
  </li>
128
104
 
129
105
 
130
- <li class="odd ">
106
+ <li class="even ">
131
107
  <div class="item">
132
108
  <span class='object_link'><a href="EnhancedErrors.html#capture_rescue=-class_method" title="EnhancedErrors.capture_rescue= (method)">capture_rescue=</a></span>
133
109
  <small>EnhancedErrors</small>
@@ -135,7 +111,7 @@
135
111
  </li>
136
112
 
137
113
 
138
- <li class="even ">
114
+ <li class="odd ">
139
115
  <div class="item">
140
116
  <span class='object_link'><a href="ExceptionBindingInfos.html#captured_variables-instance_method" title="ExceptionBindingInfos#captured_variables (method)">#captured_variables</a></span>
141
117
  <small>ExceptionBindingInfos</small>
@@ -143,7 +119,7 @@
143
119
  </li>
144
120
 
145
121
 
146
- <li class="odd ">
122
+ <li class="even ">
147
123
  <div class="item">
148
124
  <span class='object_link'><a href="EnhancedErrors.html#class_to_string-class_method" title="EnhancedErrors.class_to_string (method)">class_to_string</a></span>
149
125
  <small>EnhancedErrors</small>
@@ -151,7 +127,7 @@
151
127
  </li>
152
128
 
153
129
 
154
- <li class="even ">
130
+ <li class="odd ">
155
131
  <div class="item">
156
132
  <span class='object_link'><a href="EnhancedExceptionContext.html#clear_all-instance_method" title="EnhancedExceptionContext#clear_all (method)">#clear_all</a></span>
157
133
  <small>EnhancedExceptionContext</small>
@@ -159,7 +135,7 @@
159
135
  </li>
160
136
 
161
137
 
162
- <li class="odd ">
138
+ <li class="even ">
163
139
  <div class="item">
164
140
  <span class='object_link'><a href="EnhancedExceptionContext.html#clear_context-instance_method" title="EnhancedExceptionContext#clear_context (method)">#clear_context</a></span>
165
141
  <small>EnhancedExceptionContext</small>
@@ -167,7 +143,7 @@
167
143
  </li>
168
144
 
169
145
 
170
- <li class="even ">
146
+ <li class="odd ">
171
147
  <div class="item">
172
148
  <span class='object_link'><a href="Enhanced/Colors.html#code-class_method" title="Enhanced::Colors.code (method)">code</a></span>
173
149
  <small>Enhanced::Colors</small>
@@ -175,7 +151,7 @@
175
151
  </li>
176
152
 
177
153
 
178
- <li class="odd ">
154
+ <li class="even ">
179
155
  <div class="item">
180
156
  <span class='object_link'><a href="Enhanced/Colors.html#color-class_method" title="Enhanced::Colors.color (method)">color</a></span>
181
157
  <small>Enhanced::Colors</small>
@@ -183,7 +159,7 @@
183
159
  </li>
184
160
 
185
161
 
186
- <li class="even ">
162
+ <li class="odd ">
187
163
  <div class="item">
188
164
  <span class='object_link'><a href="EnhancedErrors.html#config_block-class_method" title="EnhancedErrors.config_block (method)">config_block</a></span>
189
165
  <small>EnhancedErrors</small>
@@ -191,7 +167,7 @@
191
167
  </li>
192
168
 
193
169
 
194
- <li class="odd ">
170
+ <li class="even ">
195
171
  <div class="item">
196
172
  <span class='object_link'><a href="EnhancedExceptionContext.html#context_for-instance_method" title="EnhancedExceptionContext#context_for (method)">#context_for</a></span>
197
173
  <small>EnhancedExceptionContext</small>
@@ -199,7 +175,7 @@
199
175
  </li>
200
176
 
201
177
 
202
- <li class="even ">
178
+ <li class="odd ">
203
179
  <div class="item">
204
180
  <span class='object_link'><a href="EnhancedErrors.html#convert_binding_to_binding_info-class_method" title="EnhancedErrors.convert_binding_to_binding_info (method)">convert_binding_to_binding_info</a></span>
205
181
  <small>EnhancedErrors</small>
@@ -207,7 +183,7 @@
207
183
  </li>
208
184
 
209
185
 
210
- <li class="odd ">
186
+ <li class="even ">
211
187
  <div class="item">
212
188
  <span class='object_link'><a href="EnhancedErrors.html#disable_capturing!-class_method" title="EnhancedErrors.disable_capturing! (method)">disable_capturing!</a></span>
213
189
  <small>EnhancedErrors</small>
@@ -215,7 +191,7 @@
215
191
  </li>
216
192
 
217
193
 
218
- <li class="even ">
194
+ <li class="odd ">
219
195
  <div class="item">
220
196
  <span class='object_link'><a href="EnhancedErrors.html#eligible_for_capture-class_method" title="EnhancedErrors.eligible_for_capture (method)">eligible_for_capture</a></span>
221
197
  <small>EnhancedErrors</small>
@@ -223,7 +199,7 @@
223
199
  </li>
224
200
 
225
201
 
226
- <li class="odd ">
202
+ <li class="even ">
227
203
  <div class="item">
228
204
  <span class='object_link'><a href="EnhancedErrors.html#enabled-class_method" title="EnhancedErrors.enabled (method)">enabled</a></span>
229
205
  <small>EnhancedErrors</small>
@@ -231,7 +207,7 @@
231
207
  </li>
232
208
 
233
209
 
234
- <li class="even ">
210
+ <li class="odd ">
235
211
  <div class="item">
236
212
  <span class='object_link'><a href="Enhanced/Colors.html#enabled=-class_method" title="Enhanced::Colors.enabled= (method)">enabled=</a></span>
237
213
  <small>Enhanced::Colors</small>
@@ -239,7 +215,7 @@
239
215
  </li>
240
216
 
241
217
 
242
- <li class="odd ">
218
+ <li class="even ">
243
219
  <div class="item">
244
220
  <span class='object_link'><a href="Enhanced/Colors.html#enabled%3F-class_method" title="Enhanced::Colors.enabled? (method)">enabled?</a></span>
245
221
  <small>Enhanced::Colors</small>
@@ -247,17 +223,9 @@
247
223
  </li>
248
224
 
249
225
 
250
- <li class="even ">
251
- <div class="item">
252
- <span class='object_link'><a href="EnhancedErrors.html#enhance_exceptions!-class_method" title="EnhancedErrors.enhance_exceptions! (method)">enhance_exceptions!</a></span>
253
- <small>EnhancedErrors</small>
254
- </div>
255
- </li>
256
-
257
-
258
226
  <li class="odd ">
259
227
  <div class="item">
260
- <span class='object_link'><a href="EnhancedErrors.html#exception_trace-class_method" title="EnhancedErrors.exception_trace (method)">exception_trace</a></span>
228
+ <span class='object_link'><a href="EnhancedErrors.html#enhance_exceptions!-class_method" title="EnhancedErrors.enhance_exceptions! (method)">enhance_exceptions!</a></span>
261
229
  <small>EnhancedErrors</small>
262
230
  </div>
263
231
  </li>
@@ -265,7 +233,7 @@
265
233
 
266
234
  <li class="even ">
267
235
  <div class="item">
268
- <span class='object_link'><a href="EnhancedErrors.html#format-class_method" title="EnhancedErrors.format (method)">format</a></span>
236
+ <span class='object_link'><a href="EnhancedErrors.html#exception_trace-class_method" title="EnhancedErrors.exception_trace (method)">exception_trace</a></span>
269
237
  <small>EnhancedErrors</small>
270
238
  </div>
271
239
  </li>
@@ -273,7 +241,7 @@
273
241
 
274
242
  <li class="odd ">
275
243
  <div class="item">
276
- <span class='object_link'><a href="EnhancedErrors.html#get_default_format_for_environment-class_method" title="EnhancedErrors.get_default_format_for_environment (method)">get_default_format_for_environment</a></span>
244
+ <span class='object_link'><a href="EnhancedErrors.html#format-class_method" title="EnhancedErrors.format (method)">format</a></span>
277
245
  <small>EnhancedErrors</small>
278
246
  </div>
279
247
  </li>
@@ -281,7 +249,7 @@
281
249
 
282
250
  <li class="even ">
283
251
  <div class="item">
284
- <span class='object_link'><a href="EnhancedErrors.html#increment_capture_events_count-class_method" title="EnhancedErrors.increment_capture_events_count (method)">increment_capture_events_count</a></span>
252
+ <span class='object_link'><a href="EnhancedErrors.html#get_default_format_for_environment-class_method" title="EnhancedErrors.get_default_format_for_environment (method)">get_default_format_for_environment</a></span>
285
253
  <small>EnhancedErrors</small>
286
254
  </div>
287
255
  </li>
@@ -311,22 +279,6 @@
311
279
  </li>
312
280
 
313
281
 
314
- <li class="even ">
315
- <div class="item">
316
- <span class='object_link'><a href="EnhancedErrors.html#max_capture_events-class_method" title="EnhancedErrors.max_capture_events (method)">max_capture_events</a></span>
317
- <small>EnhancedErrors</small>
318
- </div>
319
- </li>
320
-
321
-
322
- <li class="odd ">
323
- <div class="item">
324
- <span class='object_link'><a href="EnhancedErrors.html#max_capture_events=-class_method" title="EnhancedErrors.max_capture_events= (method)">max_capture_events=</a></span>
325
- <small>EnhancedErrors</small>
326
- </div>
327
- </li>
328
-
329
-
330
282
  <li class="even ">
331
283
  <div class="item">
332
284
  <span class='object_link'><a href="EnhancedErrors.html#max_capture_length-class_method" title="EnhancedErrors.max_capture_length (method)">max_capture_length</a></span>
@@ -448,14 +400,6 @@
448
400
 
449
401
 
450
402
  <li class="odd ">
451
- <div class="item">
452
- <span class='object_link'><a href="EnhancedErrors.html#safe_prepend_module-class_method" title="EnhancedErrors.safe_prepend_module (method)">safe_prepend_module</a></span>
453
- <small>EnhancedErrors</small>
454
- </div>
455
- </li>
456
-
457
-
458
- <li class="even ">
459
403
  <div class="item">
460
404
  <span class='object_link'><a href="EnhancedErrors.html#skip_list-class_method" title="EnhancedErrors.skip_list (method)">skip_list</a></span>
461
405
  <small>EnhancedErrors</small>
@@ -463,7 +407,7 @@
463
407
  </li>
464
408
 
465
409
 
466
- <li class="odd ">
410
+ <li class="even ">
467
411
  <div class="item">
468
412
  <span class='object_link'><a href="EnhancedErrors.html#start_minitest_binding_capture-class_method" title="EnhancedErrors.start_minitest_binding_capture (method)">start_minitest_binding_capture</a></span>
469
413
  <small>EnhancedErrors</small>
@@ -471,7 +415,7 @@
471
415
  </li>
472
416
 
473
417
 
474
- <li class="even ">
418
+ <li class="odd ">
475
419
  <div class="item">
476
420
  <span class='object_link'><a href="EnhancedErrors.html#start_rspec_binding_capture-class_method" title="EnhancedErrors.start_rspec_binding_capture (method)">start_rspec_binding_capture</a></span>
477
421
  <small>EnhancedErrors</small>
@@ -479,7 +423,7 @@
479
423
  </li>
480
424
 
481
425
 
482
- <li class="odd ">
426
+ <li class="even ">
483
427
  <div class="item">
484
428
  <span class='object_link'><a href="EnhancedErrors.html#stop_minitest_binding_capture-class_method" title="EnhancedErrors.stop_minitest_binding_capture (method)">stop_minitest_binding_capture</a></span>
485
429
  <small>EnhancedErrors</small>
@@ -487,7 +431,7 @@
487
431
  </li>
488
432
 
489
433
 
490
- <li class="even ">
434
+ <li class="odd ">
491
435
  <div class="item">
492
436
  <span class='object_link'><a href="EnhancedErrors.html#stop_rspec_binding_capture-class_method" title="EnhancedErrors.stop_rspec_binding_capture (method)">stop_rspec_binding_capture</a></span>
493
437
  <small>EnhancedErrors</small>
@@ -495,7 +439,7 @@
495
439
  </li>
496
440
 
497
441
 
498
- <li class="odd ">
442
+ <li class="even ">
499
443
  <div class="item">
500
444
  <span class='object_link'><a href="EnhancedExceptionContext.html#store_context-instance_method" title="EnhancedExceptionContext#store_context (method)">#store_context</a></span>
501
445
  <small>EnhancedExceptionContext</small>
@@ -503,7 +447,7 @@
503
447
  </li>
504
448
 
505
449
 
506
- <li class="even ">
450
+ <li class="odd ">
507
451
  <div class="item">
508
452
  <span class='object_link'><a href="EnhancedErrors.html#validate_binding_format-class_method" title="EnhancedErrors.validate_binding_format (method)">validate_binding_format</a></span>
509
453
  <small>EnhancedErrors</small>
@@ -102,11 +102,9 @@
102
102
  <dt id="IGNORED_EXCEPTIONS-constant" class="">IGNORED_EXCEPTIONS =
103
103
 
104
104
  </dt>
105
- <dd><pre class="code"><span class='qwords_beg'>%w[</span><span class='tstring_content'>SystemExit</span><span class='words_sep'> </span><span class='tstring_content'>NoMemoryError</span><span class='words_sep'> </span><span class='tstring_content'>SignalException</span><span class='words_sep'> </span><span class='tstring_content'>Interrupt</span><span class='words_sep'>
106
- </span><span class='tstring_content'>ScriptError</span><span class='words_sep'> </span><span class='tstring_content'>LoadError</span><span class='words_sep'> </span><span class='tstring_content'>NotImplementedError</span><span class='words_sep'> </span><span class='tstring_content'>SyntaxError</span><span class='words_sep'>
107
- </span><span class='tstring_content'>RSpec::Expectations::ExpectationNotMetError</span><span class='words_sep'>
108
- </span><span class='tstring_content'>RSpec::Matchers::BuiltIn::RaiseError</span><span class='words_sep'>
109
- </span><span class='tstring_content'>SystemStackError</span><span class='words_sep'> </span><span class='tstring_content'>Psych::BadAlias</span><span class='tstring_end'>]</span></span></pre></dd>
105
+ <dd><pre class="code"><span class='qwords_beg'>%w[</span><span class='tstring_content'>SystemExit</span><span class='words_sep'> </span><span class='tstring_content'>NoMemoryError</span><span class='words_sep'> </span><span class='tstring_content'>SignalException</span><span class='words_sep'> </span><span class='tstring_content'>Interrupt</span><span class='words_sep'> </span><span class='tstring_content'>ScriptError</span><span class='words_sep'> </span><span class='tstring_content'>LoadError</span><span class='words_sep'>
106
+ </span><span class='tstring_content'>NotImplementedError</span><span class='words_sep'> </span><span class='tstring_content'>SyntaxError</span><span class='words_sep'> </span><span class='tstring_content'>RSpec::Expectations::ExpectationNotMetError</span><span class='words_sep'>
107
+ </span><span class='tstring_content'>RSpec::Matchers::BuiltIn::RaiseError</span><span class='words_sep'> </span><span class='tstring_content'>SystemStackError</span><span class='words_sep'> </span><span class='tstring_content'>Psych::BadAlias</span><span class='tstring_end'>]</span></span></pre></dd>
110
108
 
111
109
  </dl>
112
110
 
@@ -122,7 +120,7 @@
122
120
  </div>
123
121
 
124
122
  <div id="footer">
125
- Generated on Tue Dec 17 15:42:48 2024 by
123
+ Generated on Tue Dec 17 21:43:58 2024 by
126
124
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
127
125
  0.9.37 (ruby-3.3.6).
128
126
  </div>
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "enhanced_errors"
3
- spec.version = "3.0.1"
3
+ spec.version = "3.0.2"
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."
@@ -9,6 +9,7 @@ module Minitest
9
9
  begin
10
10
  binding_infos = EnhancedErrors.stop_minitest_binding_capture
11
11
  EnhancedErrors.override_exception_message(result.failures.last, binding_infos) if result.failures.any?
12
+ EnhancedExceptionContext.clear_all
12
13
  rescue => e
13
14
  puts "Ignored error during error enhancement: #{e}"
14
15
  end
@@ -7,11 +7,9 @@ require 'monitor'
7
7
  require_relative 'enhanced/colors'
8
8
  require_relative 'enhanced/exception'
9
9
 
10
- IGNORED_EXCEPTIONS = %w[SystemExit NoMemoryError SignalException Interrupt
11
- ScriptError LoadError NotImplementedError SyntaxError
12
- RSpec::Expectations::ExpectationNotMetError
13
- RSpec::Matchers::BuiltIn::RaiseError
14
- SystemStackError Psych::BadAlias]
10
+ IGNORED_EXCEPTIONS = %w[SystemExit NoMemoryError SignalException Interrupt ScriptError LoadError
11
+ NotImplementedError SyntaxError RSpec::Expectations::ExpectationNotMetError
12
+ RSpec::Matchers::BuiltIn::RaiseError SystemStackError Psych::BadAlias]
15
13
 
16
14
  class EnhancedErrors
17
15
  extend ::Enhanced
@@ -24,8 +22,8 @@ class EnhancedErrors
24
22
  attr_accessor :enabled, :config_block, :on_capture_hook, :eligible_for_capture, :exception_trace, :override_messages
25
23
 
26
24
  GEMS_REGEX = %r{[\/\\]gems[\/\\]}
27
- DEFAULT_MAX_CAPTURE_LENGTH = 2500
28
- MAX_BINDING_INFOS = 3
25
+ DEFAULT_MAX_CAPTURE_LENGTH = 2200
26
+ MAX_BINDING_INFOS = 2
29
27
 
30
28
  RSPEC_SKIP_LIST = [
31
29
  :@__inspect_output,
@@ -86,6 +84,16 @@ class EnhancedErrors
86
84
 
87
85
  RSPEC_HANDLER_NAMES = ['RSpec::Expectations::PositiveExpectationHandler', 'RSpec::Expectations::NegativeExpectationHandler']
88
86
 
87
+ CI_ENV_VARS = {
88
+ 'CI' => ENV['CI'],
89
+ 'JENKINS' => ENV['JENKINS'],
90
+ 'GITHUB_ACTIONS' => ENV['GITHUB_ACTIONS'],
91
+ 'CIRCLECI' => ENV['CIRCLECI'],
92
+ 'TRAVIS' => ENV['TRAVIS'],
93
+ 'APPVEYOR' => ENV['APPVEYOR'],
94
+ 'GITLAB_CI' => ENV['GITLAB_CI']
95
+ }
96
+
89
97
  @enabled = nil
90
98
  @max_capture_length = nil
91
99
  @capture_rescue = nil
@@ -98,10 +106,6 @@ class EnhancedErrors
98
106
  @exception_trace = nil
99
107
  @override_messages = nil
100
108
 
101
- # Default values
102
- @max_capture_events = -1 # -1 means no limit
103
- @capture_events_count = 0
104
-
105
109
  # Thread-safe getters and setters
106
110
  def enabled=(val)
107
111
  mutex.synchronize { @enabled = val }
@@ -119,19 +123,6 @@ class EnhancedErrors
119
123
  mutex.synchronize { @capture_rescue }
120
124
  end
121
125
 
122
- def capture_events_count
123
- mutex.synchronize { @capture_events_count || 0 }
124
- end
125
-
126
- def capture_events_count=(val)
127
- mutex.synchronize { @capture_events_count = val }
128
- end
129
-
130
- def max_capture_events
131
- mutex.synchronize { @max_capture_events || -1 }
132
- end
133
-
134
-
135
126
  def max_capture_length
136
127
  mutex.synchronize { @max_capture_length || DEFAULT_MAX_CAPTURE_LENGTH }
137
128
  end
@@ -140,18 +131,6 @@ class EnhancedErrors
140
131
  mutex.synchronize { @max_capture_length = value }
141
132
  end
142
133
 
143
- def max_capture_events=(value)
144
- mutex.synchronize do
145
- @max_capture_events = value
146
- end
147
- end
148
-
149
- def capture_limit_exceeded?
150
- mutex.synchronize do
151
- max_capture_events > 0 && capture_events_count >= max_capture_events
152
- end
153
- end
154
-
155
134
  def disable_capturing!
156
135
  mutex.synchronize do
157
136
  @enabled = false
@@ -170,7 +149,6 @@ class EnhancedErrors
170
149
  @rspec_tracepoint = nil
171
150
  @minitest_trace = nil
172
151
  @exception_trace = nil
173
- @capture_events_count = 0
174
152
  @enabled = true
175
153
  end
176
154
  end
@@ -224,14 +202,8 @@ class EnhancedErrors
224
202
  @output_format = nil
225
203
  @eligible_for_capture = nil
226
204
  @original_global_variables = nil
227
- @override_messages = override_messages
228
-
229
- # Ensure these are not nil
230
- if @max_capture_events.nil?
231
- @max_capture_events = -1
232
- end
233
- @capture_events_count ||= 0
234
205
 
206
+ @override_messages = override_messages
235
207
  @rspec_failure_message_loaded = true
236
208
 
237
209
  @enabled = enabled
@@ -252,32 +224,12 @@ class EnhancedErrors
252
224
 
253
225
  validate_and_set_capture_events(capture_events)
254
226
 
255
- # If max_capture_events == 0, capturing is off from the start.
256
- if @max_capture_events == 0
257
- @enabled = false
258
- return
259
- end
260
-
261
227
  events = @capture_events ? @capture_events.to_a : default_capture_events
262
228
  @exception_trace = TracePoint.new(*events) do |tp|
263
229
  handle_tracepoint_event(tp)
264
230
  end
265
231
 
266
- # Only enable trace if still enabled and not limited
267
- if @enabled && (@max_capture_events == -1 || @capture_events_count < @max_capture_events)
268
- @exception_trace.enable
269
- end
270
- end
271
- end
272
-
273
- def safe_prepend_module(target_class, mod)
274
- mutex.synchronize do
275
- if defined?(target_class) && target_class.is_a?(Module)
276
- target_class.prepend(mod)
277
- true
278
- else
279
- false
280
- end
232
+ @exception_trace.enable if @enabled
281
233
  end
282
234
  end
283
235
 
@@ -286,6 +238,7 @@ class EnhancedErrors
286
238
  end
287
239
 
288
240
  def start_minitest_binding_capture
241
+ EnhancedExceptionContext.clear_all
289
242
  @enabled = true if @enabled.nil?
290
243
  return unless @enabled
291
244
  mutex.synchronize do
@@ -298,7 +251,6 @@ class EnhancedErrors
298
251
  end
299
252
 
300
253
  def stop_minitest_binding_capture
301
- disable_capturing! if capture_limit_exceeded?
302
254
  mutex.synchronize do
303
255
  @minitest_trace&.disable
304
256
  @minitest_trace = nil
@@ -320,6 +272,7 @@ class EnhancedErrors
320
272
  end
321
273
 
322
274
  def start_rspec_binding_capture
275
+ EnhancedExceptionContext.clear_all
323
276
  @enabled = true if @enabled.nil?
324
277
  return unless @enabled
325
278
 
@@ -358,7 +311,6 @@ class EnhancedErrors
358
311
  end
359
312
 
360
313
  def stop_rspec_binding_capture
361
- disable_capturing! if capture_limit_exceeded?
362
314
  mutex.synchronize do
363
315
  @rspec_tracepoint&.disable
364
316
  @rspec_tracepoint = nil
@@ -502,16 +454,8 @@ class EnhancedErrors
502
454
  def running_in_ci?
503
455
  mutex.synchronize do
504
456
  return @running_in_ci if defined?(@running_in_ci)
505
- ci_env_vars = {
506
- 'CI' => ENV['CI'],
507
- 'JENKINS' => ENV['JENKINS'],
508
- 'GITHUB_ACTIONS' => ENV['GITHUB_ACTIONS'],
509
- 'CIRCLECI' => ENV['CIRCLECI'],
510
- 'TRAVIS' => ENV['TRAVIS'],
511
- 'APPVEYOR' => ENV['APPVEYOR'],
512
- 'GITLAB_CI' => ENV['GITLAB_CI']
513
- }
514
- @running_in_ci = ci_env_vars.any? { |_, value| value.to_s.downcase == 'true' }
457
+
458
+ @running_in_ci = CI_ENV_VARS.any? { |_, value| value.to_s.downcase == 'true' }
515
459
  end
516
460
  end
517
461
 
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: 3.0.1
4
+ version: 3.0.2
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-12-17 00:00:00.000000000 Z
11
+ date: 2024-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: awesome_print
@@ -141,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
141
  - !ruby/object:Gem::Version
142
142
  version: '0'
143
143
  requirements: []
144
- rubygems_version: 3.3.26
144
+ rubygems_version: 3.5.22
145
145
  signing_key:
146
146
  specification_version: 4
147
147
  summary: Automatically enhance your errors with messages containing variable values