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

[v3] Streamline error types #1219

Closed
lestrrat opened this issue Oct 24, 2024 · 0 comments · Fixed by #1220
Closed

[v3] Streamline error types #1219

lestrrat opened this issue Oct 24, 2024 · 0 comments · Fixed by #1220
Assignees

Comments

@lestrrat
Copy link
Collaborator

Over the years I've had several reports about wanting to differentiate error types.

When I initially started developing this module, the state of error reporting in Go was still kind of meh, fmt.Errorf didn't exist, errors.Join didn't exist, etc. Opaque errors were recommended but I did not want to keep adding new error types or values ad infinitum, so I went the route of using (now deprecated) github.com/pkg/errors, which subsequently got replaced by fmt.Errorf

But now that I'm preparing to release v3, I believe the codebase is more or less stable and I can safely add error types/values as needed, and the required tooling now exist in Go itself.

General approach:

  • Deprecate all IsXXXXError, use errors.Is
  • Use specific error types (b/c I like it that way)
  • Use utility function to wrap errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant