Repository navigation
Commit 72943b3
Add a recipe for customizing exc dict formatting (#817)
* Add a recipe for customizing exc dict formatting
A new recipe titled "Custom Filtering of Dict Tracebacks" shows how to
subclass an ExceptionDictTransformer, dig around in the chain of
exceptions, sift through "locals", and make in-place modifications.
As a good demo of the sort of expensive function you might want to tie
to such operations, the example defines "high entropy strings" as
anything with a Shannon Entropy > 4.0 (which is arbitrary but somewhat
low).
In the `exceptions` documentation, a link is provided to this example
along with a direct indication that users should start by looking at the
parameters for `ExceptionDictTransformer`, which covers most cases.
resolves #789, #715
* Remove 'high entropy string' example from recipes
Per review, it's too likely that someone will pick this example up and
run it without understanding that "entropy" does not measure whether or
not a string is a secret.
Co-authored-by: Hynek Schlawack <[email protected]>
* Add cautionary note to 'custom dict trace' recipe
* Apply suggestions from code review
Two blank lines before section headers
Co-authored-by: Hynek Schlawack <[email protected]>
---------
Co-authored-by: Hynek Schlawack <[email protected]>
Co-authored-by: Hynek Schlawack <[email protected]>1 parent fcdca9f commit 72943b3
2 files changed
Lines changed: 49 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
30 | 36 | | |
31 | 37 | | |
32 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
144 | 187 | | |
145 | 188 | | |
146 | 189 | | |
| |||
0 commit comments