Skip to content

Commit 3bd7a8f

Browse files
authored
fix(i18n): wrap error in loader (#1202)
## What? Replaced the `%v` verb with `%w` in `i18n/loader.go` when returning errors from the embedded loader. ## Why? The current implementation stringifies the underlying `err` using `%v`, which breaks the error chain. This prevents callers from inspecting the root cause using `errors.Is()` or `errors.As()`. Utilizing double `%w` (supported in Go 1.20+) ensures both `ErrLoadFailed` and the original error remain accessible in the error tree. Closes #1051
1 parent cecc8d3 commit 3bd7a8f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎i18n/loader.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
func LoadTranslations(bundle *Bundle) error {
1414
// Load from embedded files
1515
if err := loadFromEmbedded(bundle); err != nil {
16-
return fmt.Errorf("%w: embedded load failed: %v", ErrLoadFailed, err)
16+
return fmt.Errorf("%w: embedded load failed: %w", ErrLoadFailed, err)
1717
}
1818

1919
return nil

0 commit comments

Comments
 (0)