Skip to content

fix(i18n): wrap parse error cause#1319

Merged
andrinoff merged 1 commit into
floatpane:masterfrom
resolvicomai:fix/i18n-parse-error-chain
May 21, 2026
Merged

fix(i18n): wrap parse error cause#1319
andrinoff merged 1 commit into
floatpane:masterfrom
resolvicomai:fix/i18n-parse-error-chain

Conversation

@resolvicomai
Copy link
Copy Markdown
Contributor

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.

Tests

  • go test ./i18n -count=1 -run TestParseJSONWrapsSyntaxError
  • go test ./i18n -count=1
  • go test ./...
  • make lint
  • git diff --check

@resolvicomai resolvicomai requested a review from a team as a code owner May 21, 2026 05:13
@floatpanebot floatpanebot added bug Something isn't working size/S Diff: 11–50 lines area/i18n Localization / translations labels May 21, 2026
Copy link
Copy Markdown
Member

@FromSi FromSi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@andrinoff andrinoff merged commit 8daca65 into floatpane:master May 21, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/i18n Localization / translations bug Something isn't working size/S Diff: 11–50 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: fmt.Errorf chain '%w: %v' loses original cause in i18n parser

4 participants