Commit 31398b3
Use Exception#detailed_message hook for lazy loading error enhancer gems
Prepend an Exception::DetailedMessage module on Exception that
lazily loads error_highlight, did_you_mean, and syntax_suggest on
first detailed_message call.
Before loading, check whether any gem has already prepended
detailed_message above us in the MRO (e.g. via -r flag). After
loading and removing the hook method:
- If gems were already above: use super (they already ran)
- If gems were just loaded: re-dispatch via detailed_message(...)
so their newly-prepended methods participate
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 538c28b commit 31398b3
1 file changed
Lines changed: 23 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
39 | 40 | | |
| 41 | + | |
40 | 42 | | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
45 | 63 | | |
46 | 64 | | |
47 | | - | |
48 | | - | |
| 65 | + | |
49 | 66 | | |
0 commit comments