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

Make fault.Wrap nil tolerant #20

Closed
spearson78 opened this issue Nov 24, 2022 · 1 comment
Closed

Make fault.Wrap nil tolerant #20

spearson78 opened this issue Nov 24, 2022 · 1 comment
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@spearson78
Copy link

I found it counter intuitive that fault.Wrap panicked when I passed a nil error.
I tried to upgrade my code by simply replacing

return x,err

with

return x,fault.Wrap(x,fctx.With(ctx))

However sometimes the err in my code is nil and fault.Wrap panicked.

For an error handling library it makes sense to me to not introduce panics into code.

I have these changes on my optional location branch (https://github.com/spearson78/fault/tree/floc). I can separate out the changes if needed.

@Southclaws
Copy link
Owner

Yeah this one is a leakage of some internal rules around errors, an opinionated take on when to wrap errors. We use some linting tools to prevent this but you're right, this shouldn't be a strongly opinionated library in this regard.

Happy to accept a PR for fault and the other sub-packages to resolve this!

@Southclaws Southclaws added bug Something isn't working good first issue Good for newcomers labels Nov 30, 2022
Southclaws added a commit that referenced this issue Nov 30, 2022
Southclaws added a commit that referenced this issue Nov 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants