Commit 8daca65
authored
fix(i18n): wrap parse error cause (#1319)
## What?
- Wrap the JSON parser source error with `%w` instead of rendering it
with `%v`.
- Add regression coverage that preserves both `ErrParseFailed` and the
original `json.SyntaxError` in the error chain.
Closes #1050
## Why?
The i18n parser already wraps `ErrParseFailed`, but the underlying JSON
parse error was converted to text. That made `errors.As` unable to
recover the original cause from callers that need to inspect it.1 parent cfbb604 commit 8daca65
2 files changed
Lines changed: 24 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
0 commit comments