You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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()).
Ah, good question. I actually can't remember off the top of my head. We can easily make a BC change to allow normal format strings plus the {{err}} which we do already (for backwards compat). Let me think why, I definitely would've wanted a normal format string too I just can't remember the reason.
Any update on this? Wrapf() is kinda misleading because it doesn't let you use regular format. And it's ugly when you have to use fmt.Sprintf() inside.
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
The text was updated successfully, but these errors were encountered: