fault
fault copied to clipboard
Add snippets
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"
}
}
Yonk, I'll be taking that from you :P
Probably make a note that, that snippet only works in vscode?
This is outdated now, errctx doesn't exist!
Updated!
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))
}