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
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