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

removed options, introduced errorcollection instead, adapted readme, … #4

Merged
merged 3 commits into from
Sep 29, 2024

Conversation

Karl1b
Copy link

@Karl1b Karl1b commented Sep 24, 2024

…adapted tests, made single quotes optional

Karl Breuer and others added 3 commits September 24, 2024 16:01
…adapted tests, made single quotes optional
- Return error instead of complex type to be more idiomatic.
- Allow options again.
- Wrap errors so consumers can use errors.Is.
- Add more tests and examples.
- Update README.
@DeanPDX
Copy link
Owner

DeanPDX commented Sep 29, 2024

Hey @Karl1b I tweaked this somewhat. Here's what I added:

  • I do think there's value in having options so I added them back. Specifically for the file IO errors, in one code path it bails completely and in the other it's the happy path.
  • I am returning an error instead of a complex type. I think this is the more idiomatic way of doing things that people will expect. I am still returning a collection of errors and consumers can interact with the err object as either a string or a collection (see new example I added and new Errors function). This approach was influenced by uber-go/multierr.
  • I added errors as variables with notes / examples on how to unwrap them and use errors.Is to handle each error type.

@DeanPDX DeanPDX merged commit c2e81e3 into DeanPDX:main Sep 29, 2024
1 check passed
@DeanPDX
Copy link
Owner

DeanPDX commented Sep 29, 2024

This closes #2

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

Successfully merging this pull request may close these issues.

2 participants