Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

verror should handle %w #208

Open
cosnicolaou opened this issue Jun 22, 2021 · 0 comments
Open

verror should handle %w #208

cosnicolaou opened this issue Jun 22, 2021 · 0 comments

Comments

@cosnicolaou
Copy link
Contributor

verror.Errorf does not currently understand %w and leads to ugly output when it's used, see the example code below outputs:

err: t: cause: %!w(*errors.errorString=&{an error})
cause: an error
package main

import (
        "errors"
        "fmt"

        "v.io/v23/verror"
)

func main() {
        var (
                cause = errors.New("an error")
                err   = verror.ErrInternal.Errorf(nil, "cause: %w", cause)
        )
        // The printing does not handle the "%w" nicely...
        fmt.Printf("err: %v\n", err)

        // ... even though the wrapping is done correctly.
        fmt.Printf("cause: %v\n", errors.Unwrap(err))
}
@cosnicolaou cosnicolaou changed the title error should handle %w verror should handle %w Jun 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant