Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ func FromYAMLFile(name string, v Validator) error {

d := yaml.NewDecoder(f, yaml.DisallowUnknownField())
if err := d.Decode(v); err != nil {
// The PrettyPrint() method of the yaml parser errors doesn't get triggered automatically, so we've to do
Copy link
Member

Choose a reason for hiding this comment

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

Of course it doesn't! PrettyPrinter#PrettyPrint() allows specifying whether to color its output. That can't be known at this point.

// it via the `yaml.FormatError` helper function. If the provided error implements `yaml.errors.PrettyPrinter`
// we'll get the prettified string of that type, otherwise just error string.
err = errors.New(yaml.FormatError(err, true, true))
return errors.Wrap(err, "can't parse YAML file "+name)
Copy link
Member

Choose a reason for hiding this comment

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

You don't need errors.New AND errors.Wrap. Both are capturing the stack.

}

Expand Down
Loading