config: add Duration test coverage and fix error wrapping
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I5c08e63297f90acdedd9744de904c36b6a6a6964
This commit is contained in:
parent
4f8d1c64d2
commit
9f264fbef1
4 changed files with 54 additions and 44 deletions
|
|
@ -21,7 +21,7 @@ func (d *Duration) UnmarshalYAML(value *yaml.Node) error {
|
|||
// Try decoding as a raw int64 (nanoseconds) as fallback.
|
||||
var ns int64
|
||||
if err2 := value.Decode(&ns); err2 != nil {
|
||||
return fmt.Errorf("cannot unmarshal duration: %w", err)
|
||||
return fmt.Errorf("cannot unmarshal duration (tried string: %v): %w", err, err2)
|
||||
}
|
||||
d.Duration = time.Duration(ns)
|
||||
return nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue