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

Use Error Type instead of fmt.Errorf #1169

Open
oxzi opened this issue Sep 4, 2024 · 0 comments
Open

Use Error Type instead of fmt.Errorf #1169

oxzi opened this issue Sep 4, 2024 · 0 comments

Comments

@oxzi
Copy link

oxzi commented Sep 4, 2024

When working with errors returned by pq, lots of those are being generated via fmt.Errorf. This makes it hard to distinguish between different types of errors later in your own code, falling back to doing string prefix checks. So I would like to ask you to provide a separate error type which can be checked downstream.

Thanks a lot for providing this library!

oxzi added a commit to Icinga/icinga-go-library that referenced this issue Sep 24, 2024
Some errors created within github.com/lib/pq are created with
fmt.Errorf, prefixed with "pq: ". Thus, they are not of the *pq.Error
type, but are clearly database errors.

A change request was created upstream in:
lib/pq#1169

Co-Authored-By: Alvar Penning <[email protected]>
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

1 participant