Commit 067f5cf
authored
Enhance robustness of data scrubbing with improved error handling (#60)
* Simplify replacement value logic in ScrubberService::autoSanitize using a ternary operator for better readability.
* Add try-catch in ScrubberService::autoSanitize to skip invalid regex patterns, preventing loop breaks.
* Update ScrubberService::patternChecker to safely update content only with non-null results from checkAndSanitize.
* Standardize nested structure handling in ProcessArrayTrait::processArrayRecursively to use recursive processing consistently.
* Wrap string sanitization in ProcessArrayTrait::processArrayRecursively with try-catch to skip problematic values.
* Enhance ProcessArrayTrait::processArray with comprehensive fallbacks for JSON encoding failures, sanitization exceptions, non-string content, and invalid JSON decoding, ensuring an array is always returned.
These changes are attempting to resolve the type exception reported in issue #501 parent 7dea161 commit 067f5cf
File tree
2 files changed
+35
-16
lines changed- src
- Services
- Strategies/ContentProcessingStrategy/Traits
2 files changed
+35
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
59 | 55 | | |
60 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
68 | 71 | | |
69 | 72 | | |
70 | 73 | | |
| |||
Lines changed: 23 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
21 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
| |||
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
38 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
39 | 55 | | |
40 | | - | |
| 56 | + | |
41 | 57 | | |
42 | 58 | | |
0 commit comments