Skip to content

Wrapf Format Question #2

@karlkfi

Description

@karlkfi

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions