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

Simplify werror #9

Closed
RussellLuo opened this issue May 20, 2021 · 0 comments
Closed

Simplify werror #9

RussellLuo opened this issue May 20, 2021 · 0 comments

Comments

@RussellLuo
Copy link
Owner

Wrap an error and inherit the error message from another one:

// Lengthy
werror.Wrap(googlecode.ErrInvalidArgument).SetError(err)

// Simplified
werror.Wrap(gcode.ErrInvalidArgument, err)

Wrap an error and set a custom error message:

// Lengthy
werror.Wrap(googlecode.ErrInvalidArgument).SetErrorf("bad request")

// Simplified
werror.Wrapf(gcode.ErrInvalidArgument, "bad request")
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