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

Add snippets #3

Open
Southclaws opened this issue Oct 19, 2022 · 4 comments
Open

Add snippets #3

Southclaws opened this issue Oct 19, 2022 · 4 comments

Comments

@Southclaws
Copy link
Owner

Southclaws commented Oct 19, 2022

Once API is v1, provide some snippets since I write errctx wrapping constantly:

{
  "if err != nil": {
    "prefix": "iferr",
    "body": [
      "if err != nil {",
      "\treturn nil, fault.Wrap(err, fctx.With(ctx))",
      "}"
    ],
    "description": "Snippet for if err != nil"
  }
}
@ADRFranklin
Copy link

Yonk, I'll be taking that from you :P

Probably make a note that, that snippet only works in vscode?

@Southclaws
Copy link
Owner Author

This is outdated now, errctx doesn't exist!

@Southclaws
Copy link
Owner Author

Updated!

@Southclaws
Copy link
Owner Author

Also, keep in mind if you're always using a specific set of decorators, you can easily build a helper:

func WrapWithDefaults(err error, ctx context.Context, message string) error {
  return fault.Wrap(err, fctx.With(ctx), fmsg.With(message))
}

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

2 participants