Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Wrap decodehook errors when reporting
Browse files Browse the repository at this point in the history
Allow mapstructure caller to use `errors.Is` and `errors.As` to determine the cause of errors returned by custom decode hooks.
  • Loading branch information
arielshaqed authored Apr 21, 2022
1 parent ab69d8d commit 3518e19
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mapstructure.go
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ func (d *Decoder) decode(name string, input interface{}, outVal reflect.Value) e
var err error
input, err = DecodeHookExec(d.config.DecodeHook, inputVal, outVal)
if err != nil {
return fmt.Errorf("error decoding '%s': %s", name, err)
return fmt.Errorf("error decoding '%s': %w", name, err)
}
}

Expand Down

0 comments on commit 3518e19

Please sign in to comment.