enhanced_errors 2.1.3 → 3.0.0
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/.yardoc/checksums +4 -2
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/README.md +2 -2
- data/doc/Context.html +283 -0
- data/doc/Enhanced/Colors.html +1 -1
- data/doc/Enhanced.html +1 -1
- data/doc/EnhancedErrors.html +350 -382
- data/doc/EnhancedExceptionContext.html +397 -0
- data/doc/Exception.html +9 -139
- data/doc/ExceptionBindingInfos.html +255 -0
- data/doc/Minitest.html +1 -1
- data/doc/_index.html +16 -1
- data/doc/class_list.html +1 -1
- data/doc/file.README.html +3 -3
- data/doc/index.html +3 -3
- data/doc/method_list.html +87 -39
- data/doc/top-level-namespace.html +3 -3
- data/enhanced_errors.gemspec +1 -1
- data/examples/demo_rspec.rb +0 -4
- data/lib/enhanced/context.rb +7 -0
- data/lib/enhanced/enhanced_exception_context.rb +47 -0
- data/lib/enhanced/exception.rb +15 -5
- data/lib/enhanced_errors.rb +20 -44
- metadata +8 -3
data/doc/method_list.html
CHANGED
@@ -73,23 +73,23 @@
|
|
73
73
|
|
74
74
|
<li class="even ">
|
75
75
|
<div class="item">
|
76
|
-
<span class='object_link'><a href="
|
77
|
-
<small>
|
76
|
+
<span class='object_link'><a href="Context.html#binding_infos-instance_method" title="Context#binding_infos (method)">#binding_infos</a></span>
|
77
|
+
<small>Context</small>
|
78
78
|
</div>
|
79
79
|
</li>
|
80
80
|
|
81
81
|
|
82
82
|
<li class="odd ">
|
83
83
|
<div class="item">
|
84
|
-
<span class='object_link'><a href="
|
85
|
-
<small>
|
84
|
+
<span class='object_link'><a href="ExceptionBindingInfos.html#binding_infos-instance_method" title="ExceptionBindingInfos#binding_infos (method)">#binding_infos</a></span>
|
85
|
+
<small>ExceptionBindingInfos</small>
|
86
86
|
</div>
|
87
87
|
</li>
|
88
88
|
|
89
89
|
|
90
90
|
<li class="even ">
|
91
91
|
<div class="item">
|
92
|
-
<span class='object_link'><a href="EnhancedErrors.html#
|
92
|
+
<span class='object_link'><a href="EnhancedErrors.html#binding_infos_array_to_string-class_method" title="EnhancedErrors.binding_infos_array_to_string (method)">binding_infos_array_to_string</a></span>
|
93
93
|
<small>EnhancedErrors</small>
|
94
94
|
</div>
|
95
95
|
</li>
|
@@ -97,7 +97,7 @@
|
|
97
97
|
|
98
98
|
<li class="odd ">
|
99
99
|
<div class="item">
|
100
|
-
<span class='object_link'><a href="EnhancedErrors.html#capture_events_count
|
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
101
|
<small>EnhancedErrors</small>
|
102
102
|
</div>
|
103
103
|
</li>
|
@@ -105,7 +105,7 @@
|
|
105
105
|
|
106
106
|
<li class="even ">
|
107
107
|
<div class="item">
|
108
|
-
<span class='object_link'><a href="EnhancedErrors.html#
|
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
109
|
<small>EnhancedErrors</small>
|
110
110
|
</div>
|
111
111
|
</li>
|
@@ -113,7 +113,7 @@
|
|
113
113
|
|
114
114
|
<li class="odd ">
|
115
115
|
<div class="item">
|
116
|
-
<span class='object_link'><a href="EnhancedErrors.html#
|
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
117
|
<small>EnhancedErrors</small>
|
118
118
|
</div>
|
119
119
|
</li>
|
@@ -121,7 +121,7 @@
|
|
121
121
|
|
122
122
|
<li class="even ">
|
123
123
|
<div class="item">
|
124
|
-
<span class='object_link'><a href="EnhancedErrors.html#capture_rescue
|
124
|
+
<span class='object_link'><a href="EnhancedErrors.html#capture_rescue-class_method" title="EnhancedErrors.capture_rescue (method)">capture_rescue</a></span>
|
125
125
|
<small>EnhancedErrors</small>
|
126
126
|
</div>
|
127
127
|
</li>
|
@@ -129,13 +129,21 @@
|
|
129
129
|
|
130
130
|
<li class="odd ">
|
131
131
|
<div class="item">
|
132
|
-
<span class='object_link'><a href="
|
133
|
-
<small>
|
132
|
+
<span class='object_link'><a href="EnhancedErrors.html#capture_rescue=-class_method" title="EnhancedErrors.capture_rescue= (method)">capture_rescue=</a></span>
|
133
|
+
<small>EnhancedErrors</small>
|
134
134
|
</div>
|
135
135
|
</li>
|
136
136
|
|
137
137
|
|
138
138
|
<li class="even ">
|
139
|
+
<div class="item">
|
140
|
+
<span class='object_link'><a href="ExceptionBindingInfos.html#captured_variables-instance_method" title="ExceptionBindingInfos#captured_variables (method)">#captured_variables</a></span>
|
141
|
+
<small>ExceptionBindingInfos</small>
|
142
|
+
</div>
|
143
|
+
</li>
|
144
|
+
|
145
|
+
|
146
|
+
<li class="odd ">
|
139
147
|
<div class="item">
|
140
148
|
<span class='object_link'><a href="EnhancedErrors.html#class_to_string-class_method" title="EnhancedErrors.class_to_string (method)">class_to_string</a></span>
|
141
149
|
<small>EnhancedErrors</small>
|
@@ -143,7 +151,23 @@
|
|
143
151
|
</li>
|
144
152
|
|
145
153
|
|
154
|
+
<li class="even ">
|
155
|
+
<div class="item">
|
156
|
+
<span class='object_link'><a href="EnhancedExceptionContext.html#clear_all-instance_method" title="EnhancedExceptionContext#clear_all (method)">#clear_all</a></span>
|
157
|
+
<small>EnhancedExceptionContext</small>
|
158
|
+
</div>
|
159
|
+
</li>
|
160
|
+
|
161
|
+
|
146
162
|
<li class="odd ">
|
163
|
+
<div class="item">
|
164
|
+
<span class='object_link'><a href="EnhancedExceptionContext.html#clear_context-instance_method" title="EnhancedExceptionContext#clear_context (method)">#clear_context</a></span>
|
165
|
+
<small>EnhancedExceptionContext</small>
|
166
|
+
</div>
|
167
|
+
</li>
|
168
|
+
|
169
|
+
|
170
|
+
<li class="even ">
|
147
171
|
<div class="item">
|
148
172
|
<span class='object_link'><a href="Enhanced/Colors.html#code-class_method" title="Enhanced::Colors.code (method)">code</a></span>
|
149
173
|
<small>Enhanced::Colors</small>
|
@@ -151,7 +175,7 @@
|
|
151
175
|
</li>
|
152
176
|
|
153
177
|
|
154
|
-
<li class="
|
178
|
+
<li class="odd ">
|
155
179
|
<div class="item">
|
156
180
|
<span class='object_link'><a href="Enhanced/Colors.html#color-class_method" title="Enhanced::Colors.color (method)">color</a></span>
|
157
181
|
<small>Enhanced::Colors</small>
|
@@ -159,7 +183,7 @@
|
|
159
183
|
</li>
|
160
184
|
|
161
185
|
|
162
|
-
<li class="
|
186
|
+
<li class="even ">
|
163
187
|
<div class="item">
|
164
188
|
<span class='object_link'><a href="EnhancedErrors.html#config_block-class_method" title="EnhancedErrors.config_block (method)">config_block</a></span>
|
165
189
|
<small>EnhancedErrors</small>
|
@@ -167,6 +191,14 @@
|
|
167
191
|
</li>
|
168
192
|
|
169
193
|
|
194
|
+
<li class="odd ">
|
195
|
+
<div class="item">
|
196
|
+
<span class='object_link'><a href="EnhancedExceptionContext.html#context_for-instance_method" title="EnhancedExceptionContext#context_for (method)">#context_for</a></span>
|
197
|
+
<small>EnhancedExceptionContext</small>
|
198
|
+
</div>
|
199
|
+
</li>
|
200
|
+
|
201
|
+
|
170
202
|
<li class="even ">
|
171
203
|
<div class="item">
|
172
204
|
<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>
|
@@ -217,7 +249,7 @@
|
|
217
249
|
|
218
250
|
<li class="even ">
|
219
251
|
<div class="item">
|
220
|
-
<span class='object_link'><a href="EnhancedErrors.html#
|
252
|
+
<span class='object_link'><a href="EnhancedErrors.html#enhance_exceptions!-class_method" title="EnhancedErrors.enhance_exceptions! (method)">enhance_exceptions!</a></span>
|
221
253
|
<small>EnhancedErrors</small>
|
222
254
|
</div>
|
223
255
|
</li>
|
@@ -225,7 +257,7 @@
|
|
225
257
|
|
226
258
|
<li class="odd ">
|
227
259
|
<div class="item">
|
228
|
-
<span class='object_link'><a href="EnhancedErrors.html#
|
260
|
+
<span class='object_link'><a href="EnhancedErrors.html#exception_trace-class_method" title="EnhancedErrors.exception_trace (method)">exception_trace</a></span>
|
229
261
|
<small>EnhancedErrors</small>
|
230
262
|
</div>
|
231
263
|
</li>
|
@@ -233,7 +265,7 @@
|
|
233
265
|
|
234
266
|
<li class="even ">
|
235
267
|
<div class="item">
|
236
|
-
<span class='object_link'><a href="EnhancedErrors.html#
|
268
|
+
<span class='object_link'><a href="EnhancedErrors.html#format-class_method" title="EnhancedErrors.format (method)">format</a></span>
|
237
269
|
<small>EnhancedErrors</small>
|
238
270
|
</div>
|
239
271
|
</li>
|
@@ -241,7 +273,7 @@
|
|
241
273
|
|
242
274
|
<li class="odd ">
|
243
275
|
<div class="item">
|
244
|
-
<span class='object_link'><a href="EnhancedErrors.html#
|
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>
|
245
277
|
<small>EnhancedErrors</small>
|
246
278
|
</div>
|
247
279
|
</li>
|
@@ -249,7 +281,7 @@
|
|
249
281
|
|
250
282
|
<li class="even ">
|
251
283
|
<div class="item">
|
252
|
-
<span class='object_link'><a href="EnhancedErrors.html#
|
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>
|
253
285
|
<small>EnhancedErrors</small>
|
254
286
|
</div>
|
255
287
|
</li>
|
@@ -257,8 +289,8 @@
|
|
257
289
|
|
258
290
|
<li class="odd ">
|
259
291
|
<div class="item">
|
260
|
-
<span class='object_link'><a href="
|
261
|
-
<small>
|
292
|
+
<span class='object_link'><a href="Context.html#initialize-instance_method" title="Context#initialize (method)">#initialize</a></span>
|
293
|
+
<small>Context</small>
|
262
294
|
</div>
|
263
295
|
</li>
|
264
296
|
|
@@ -297,7 +329,7 @@
|
|
297
329
|
|
298
330
|
<li class="even ">
|
299
331
|
<div class="item">
|
300
|
-
<span class='object_link'><a href="EnhancedErrors.html#
|
332
|
+
<span class='object_link'><a href="EnhancedErrors.html#max_capture_length-class_method" title="EnhancedErrors.max_capture_length (method)">max_capture_length</a></span>
|
301
333
|
<small>EnhancedErrors</small>
|
302
334
|
</div>
|
303
335
|
</li>
|
@@ -305,7 +337,7 @@
|
|
305
337
|
|
306
338
|
<li class="odd ">
|
307
339
|
<div class="item">
|
308
|
-
<span class='object_link'><a href="EnhancedErrors.html#
|
340
|
+
<span class='object_link'><a href="EnhancedErrors.html#max_capture_length=-class_method" title="EnhancedErrors.max_capture_length= (method)">max_capture_length=</a></span>
|
309
341
|
<small>EnhancedErrors</small>
|
310
342
|
</div>
|
311
343
|
</li>
|
@@ -313,7 +345,7 @@
|
|
313
345
|
|
314
346
|
<li class="even ">
|
315
347
|
<div class="item">
|
316
|
-
<span class='object_link'><a href="EnhancedErrors.html#
|
348
|
+
<span class='object_link'><a href="EnhancedErrors.html#mutex-class_method" title="EnhancedErrors.mutex (method)">mutex</a></span>
|
317
349
|
<small>EnhancedErrors</small>
|
318
350
|
</div>
|
319
351
|
</li>
|
@@ -321,7 +353,7 @@
|
|
321
353
|
|
322
354
|
<li class="odd ">
|
323
355
|
<div class="item">
|
324
|
-
<span class='object_link'><a href="EnhancedErrors.html#on_capture
|
356
|
+
<span class='object_link'><a href="EnhancedErrors.html#on_capture-class_method" title="EnhancedErrors.on_capture (method)">on_capture</a></span>
|
325
357
|
<small>EnhancedErrors</small>
|
326
358
|
</div>
|
327
359
|
</li>
|
@@ -329,7 +361,7 @@
|
|
329
361
|
|
330
362
|
<li class="even ">
|
331
363
|
<div class="item">
|
332
|
-
<span class='object_link'><a href="EnhancedErrors.html#
|
364
|
+
<span class='object_link'><a href="EnhancedErrors.html#on_capture=-class_method" title="EnhancedErrors.on_capture= (method)">on_capture=</a></span>
|
333
365
|
<small>EnhancedErrors</small>
|
334
366
|
</div>
|
335
367
|
</li>
|
@@ -337,7 +369,7 @@
|
|
337
369
|
|
338
370
|
<li class="odd ">
|
339
371
|
<div class="item">
|
340
|
-
<span class='object_link'><a href="EnhancedErrors.html#
|
372
|
+
<span class='object_link'><a href="EnhancedErrors.html#on_capture_hook-class_method" title="EnhancedErrors.on_capture_hook (method)">on_capture_hook</a></span>
|
341
373
|
<small>EnhancedErrors</small>
|
342
374
|
</div>
|
343
375
|
</li>
|
@@ -345,13 +377,21 @@
|
|
345
377
|
|
346
378
|
<li class="even ">
|
347
379
|
<div class="item">
|
348
|
-
<span class='object_link'><a href="EnhancedErrors.html#on_format
|
380
|
+
<span class='object_link'><a href="EnhancedErrors.html#on_format-class_method" title="EnhancedErrors.on_format (method)">on_format</a></span>
|
349
381
|
<small>EnhancedErrors</small>
|
350
382
|
</div>
|
351
383
|
</li>
|
352
384
|
|
353
385
|
|
354
386
|
<li class="odd ">
|
387
|
+
<div class="item">
|
388
|
+
<span class='object_link'><a href="EnhancedErrors.html#on_format=-class_method" title="EnhancedErrors.on_format= (method)">on_format=</a></span>
|
389
|
+
<small>EnhancedErrors</small>
|
390
|
+
</div>
|
391
|
+
</li>
|
392
|
+
|
393
|
+
|
394
|
+
<li class="even ">
|
355
395
|
<div class="item">
|
356
396
|
<span class='object_link'><a href="Minitest.html#original_run_one_method-class_method" title="Minitest.original_run_one_method (method)">original_run_one_method</a></span>
|
357
397
|
<small>Minitest</small>
|
@@ -359,7 +399,7 @@
|
|
359
399
|
</li>
|
360
400
|
|
361
401
|
|
362
|
-
<li class="
|
402
|
+
<li class="odd ">
|
363
403
|
<div class="item">
|
364
404
|
<span class='object_link'><a href="EnhancedErrors.html#override_exception_message-class_method" title="EnhancedErrors.override_exception_message (method)">override_exception_message</a></span>
|
365
405
|
<small>EnhancedErrors</small>
|
@@ -367,7 +407,7 @@
|
|
367
407
|
</li>
|
368
408
|
|
369
409
|
|
370
|
-
<li class="
|
410
|
+
<li class="even ">
|
371
411
|
<div class="item">
|
372
412
|
<span class='object_link'><a href="EnhancedErrors.html#override_messages-class_method" title="EnhancedErrors.override_messages (method)">override_messages</a></span>
|
373
413
|
<small>EnhancedErrors</small>
|
@@ -375,7 +415,7 @@
|
|
375
415
|
</li>
|
376
416
|
|
377
417
|
|
378
|
-
<li class="
|
418
|
+
<li class="odd ">
|
379
419
|
<div class="item">
|
380
420
|
<span class='object_link'><a href="EnhancedErrors.html#override_rspec_message-class_method" title="EnhancedErrors.override_rspec_message (method)">override_rspec_message</a></span>
|
381
421
|
<small>EnhancedErrors</small>
|
@@ -383,7 +423,7 @@
|
|
383
423
|
</li>
|
384
424
|
|
385
425
|
|
386
|
-
<li class="
|
426
|
+
<li class="even ">
|
387
427
|
<div class="item">
|
388
428
|
<span class='object_link'><a href="EnhancedErrors.html#reset!-class_method" title="EnhancedErrors.reset! (method)">reset!</a></span>
|
389
429
|
<small>EnhancedErrors</small>
|
@@ -391,7 +431,7 @@
|
|
391
431
|
</li>
|
392
432
|
|
393
433
|
|
394
|
-
<li class="
|
434
|
+
<li class="odd ">
|
395
435
|
<div class="item">
|
396
436
|
<span class='object_link'><a href="Minitest.html#run_one_method-class_method" title="Minitest.run_one_method (method)">run_one_method</a></span>
|
397
437
|
<small>Minitest</small>
|
@@ -399,7 +439,7 @@
|
|
399
439
|
</li>
|
400
440
|
|
401
441
|
|
402
|
-
<li class="
|
442
|
+
<li class="even ">
|
403
443
|
<div class="item">
|
404
444
|
<span class='object_link'><a href="EnhancedErrors.html#running_in_ci%3F-class_method" title="EnhancedErrors.running_in_ci? (method)">running_in_ci?</a></span>
|
405
445
|
<small>EnhancedErrors</small>
|
@@ -407,7 +447,7 @@
|
|
407
447
|
</li>
|
408
448
|
|
409
449
|
|
410
|
-
<li class="
|
450
|
+
<li class="odd ">
|
411
451
|
<div class="item">
|
412
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>
|
413
453
|
<small>EnhancedErrors</small>
|
@@ -415,7 +455,7 @@
|
|
415
455
|
</li>
|
416
456
|
|
417
457
|
|
418
|
-
<li class="
|
458
|
+
<li class="even ">
|
419
459
|
<div class="item">
|
420
460
|
<span class='object_link'><a href="EnhancedErrors.html#skip_list-class_method" title="EnhancedErrors.skip_list (method)">skip_list</a></span>
|
421
461
|
<small>EnhancedErrors</small>
|
@@ -423,7 +463,7 @@
|
|
423
463
|
</li>
|
424
464
|
|
425
465
|
|
426
|
-
<li class="
|
466
|
+
<li class="odd ">
|
427
467
|
<div class="item">
|
428
468
|
<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>
|
429
469
|
<small>EnhancedErrors</small>
|
@@ -431,7 +471,7 @@
|
|
431
471
|
</li>
|
432
472
|
|
433
473
|
|
434
|
-
<li class="
|
474
|
+
<li class="even ">
|
435
475
|
<div class="item">
|
436
476
|
<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>
|
437
477
|
<small>EnhancedErrors</small>
|
@@ -439,7 +479,7 @@
|
|
439
479
|
</li>
|
440
480
|
|
441
481
|
|
442
|
-
<li class="
|
482
|
+
<li class="odd ">
|
443
483
|
<div class="item">
|
444
484
|
<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>
|
445
485
|
<small>EnhancedErrors</small>
|
@@ -447,7 +487,7 @@
|
|
447
487
|
</li>
|
448
488
|
|
449
489
|
|
450
|
-
<li class="
|
490
|
+
<li class="even ">
|
451
491
|
<div class="item">
|
452
492
|
<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>
|
453
493
|
<small>EnhancedErrors</small>
|
@@ -455,6 +495,14 @@
|
|
455
495
|
</li>
|
456
496
|
|
457
497
|
|
498
|
+
<li class="odd ">
|
499
|
+
<div class="item">
|
500
|
+
<span class='object_link'><a href="EnhancedExceptionContext.html#store_context-instance_method" title="EnhancedExceptionContext#store_context (method)">#store_context</a></span>
|
501
|
+
<small>EnhancedExceptionContext</small>
|
502
|
+
</div>
|
503
|
+
</li>
|
504
|
+
|
505
|
+
|
458
506
|
<li class="even ">
|
459
507
|
<div class="item">
|
460
508
|
<span class='object_link'><a href="EnhancedErrors.html#validate_binding_format-class_method" title="EnhancedErrors.validate_binding_format (method)">validate_binding_format</a></span>
|
@@ -82,11 +82,11 @@
|
|
82
82
|
<p class="children">
|
83
83
|
|
84
84
|
|
85
|
-
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Enhanced.html" title="Enhanced (module)">Enhanced</a></span>, <span class='object_link'><a href="Minitest.html" title="Minitest (module)">Minitest</a></span>
|
85
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Enhanced.html" title="Enhanced (module)">Enhanced</a></span>, <span class='object_link'><a href="EnhancedExceptionContext.html" title="EnhancedExceptionContext (module)">EnhancedExceptionContext</a></span>, <span class='object_link'><a href="ExceptionBindingInfos.html" title="ExceptionBindingInfos (module)">ExceptionBindingInfos</a></span>, <span class='object_link'><a href="Minitest.html" title="Minitest (module)">Minitest</a></span>
|
86
86
|
|
87
87
|
|
88
88
|
|
89
|
-
<strong class="classes">Classes:</strong> <span class='object_link'><a href="EnhancedErrors.html" title="EnhancedErrors (class)">EnhancedErrors</a></span>, <span class='object_link'><a href="Exception.html" title="Exception (class)">Exception</a></span>
|
89
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Context.html" title="Context (class)">Context</a></span>, <span class='object_link'><a href="EnhancedErrors.html" title="EnhancedErrors (class)">EnhancedErrors</a></span>, <span class='object_link'><a href="Exception.html" title="Exception (class)">Exception</a></span>
|
90
90
|
|
91
91
|
|
92
92
|
</p>
|
@@ -122,7 +122,7 @@
|
|
122
122
|
</div>
|
123
123
|
|
124
124
|
<div id="footer">
|
125
|
-
Generated on
|
125
|
+
Generated on Tue Dec 17 15:42:48 2024 by
|
126
126
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
127
127
|
0.9.37 (ruby-3.3.6).
|
128
128
|
</div>
|
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 = "
|
3
|
+
spec.version = "3.0.0"
|
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/examples/demo_rspec.rb
CHANGED
@@ -14,10 +14,6 @@ RSpec.configure do |config|
|
|
14
14
|
EnhancedErrors.start_rspec_binding_capture
|
15
15
|
end
|
16
16
|
|
17
|
-
config.before(:example) do |_example|
|
18
|
-
EnhancedErrors.start_rspec_binding_capture
|
19
|
-
end
|
20
|
-
|
21
17
|
config.after(:example) do |example|
|
22
18
|
EnhancedErrors.override_rspec_message(example, EnhancedErrors.stop_rspec_binding_capture)
|
23
19
|
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'weakref'
|
2
|
+
|
3
|
+
require_relative 'context'
|
4
|
+
|
5
|
+
require 'weakref'
|
6
|
+
require 'monitor'
|
7
|
+
|
8
|
+
module EnhancedExceptionContext
|
9
|
+
extend self
|
10
|
+
|
11
|
+
REGISTRY = {}
|
12
|
+
MUTEX = Monitor.new
|
13
|
+
|
14
|
+
def store_context(exception, context)
|
15
|
+
MUTEX.synchronize do
|
16
|
+
REGISTRY[exception.object_id] = { weak_exc: WeakRef.new(exception), context: context }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def context_for(exception)
|
21
|
+
MUTEX.synchronize do
|
22
|
+
entry = REGISTRY[exception.object_id]
|
23
|
+
return nil unless entry
|
24
|
+
|
25
|
+
begin
|
26
|
+
_ = entry[:weak_exc].__getobj__ # ensure exception is still alive
|
27
|
+
entry[:context]
|
28
|
+
rescue RefError
|
29
|
+
# Exception no longer alive, clean up
|
30
|
+
REGISTRY.delete(exception.object_id)
|
31
|
+
nil
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def clear_context(exception)
|
37
|
+
MUTEX.synchronize do
|
38
|
+
REGISTRY.delete(exception.object_id)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def clear_all
|
43
|
+
MUTEX.synchronize do
|
44
|
+
REGISTRY.clear
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
data/lib/enhanced/exception.rb
CHANGED
@@ -1,6 +1,16 @@
|
|
1
1
|
# exception.rb
|
2
|
+
require_relative 'enhanced_exception_context'
|
3
|
+
|
4
|
+
module ExceptionBindingInfos
|
5
|
+
def binding_infos
|
6
|
+
ctx = EnhancedExceptionContext.context_for(self)
|
7
|
+
unless ctx
|
8
|
+
ctx = Context.new
|
9
|
+
EnhancedExceptionContext.store_context(self, ctx)
|
10
|
+
end
|
11
|
+
ctx.binding_infos
|
12
|
+
end
|
2
13
|
|
3
|
-
class Exception
|
4
14
|
def captured_variables
|
5
15
|
if binding_infos.any?
|
6
16
|
bindings_of_interest = select_binding_infos
|
@@ -12,10 +22,6 @@ class Exception
|
|
12
22
|
''
|
13
23
|
end
|
14
24
|
|
15
|
-
def binding_infos
|
16
|
-
@binding_infos ||= []
|
17
|
-
end
|
18
|
-
|
19
25
|
private
|
20
26
|
|
21
27
|
def select_binding_infos
|
@@ -43,3 +49,7 @@ class Exception
|
|
43
49
|
bindings_of_interest.compact
|
44
50
|
end
|
45
51
|
end
|
52
|
+
|
53
|
+
class Exception
|
54
|
+
prepend ExceptionBindingInfos
|
55
|
+
end
|