hashicorp / hashicorp/errwrap

Wrapf Format Question

Open
#2 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
454
Forks
31
Avg merge
22h 24m
Merged PRs (30d)
1

Description

For context, we have similar wrapping code here: https://github.com/cloudfoundry/bosh-agent/blob/master/errors/errors.go#L52

I'm wondering why you guys decided to allow the user to specify where (and if) the error string from the wrapped error gets included in the new error message.

Do you have special use cases where you need to format them differently? It seems like having a standard pattern would be sufficient, like `fmt.Sprintf("%s: %s", msg, err.Error())`.

We found that if more complex formatting was required the user could easily traverse the error chain and craft their own custom message format, like we did here: https://github.com/cloudfoundry/bosh-init/blob/master/ui/fmt/error.go

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.