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

Consistently wrap errors #115

Open
julianbrost opened this issue Oct 24, 2023 · 2 comments · May be fixed by #133
Open

Consistently wrap errors #115

julianbrost opened this issue Oct 24, 2023 · 2 comments · May be fixed by #133
Assignees

Comments

@julianbrost
Copy link
Collaborator

During the review of #99, I noticed there's already quite a bit of error handling in internal/incident/incident.go that returns entirely new errors instead of wrapping the errors that caused that error condition.

I don't see a reason why we wouldn't want to wrap errors there, but maybe @yhabteab does (pinging you as you wrote large parts of that code). If not, we should go over that code and adapt the error handling (I only noticed it in this file so far, but scrolling over all uses of errors.New() and fmt.Errorf() without %w probably doesn't hurt).

@yhabteab
Copy link
Member

I guess I did this purely as we already log the actual error, it just makes it uglier to reveal any internal database query errors further out to the clients. They just need to be aware that something went wrong. Icinga 2 also does not disclose all API request failures, what the actual error was.

@julianbrost
Copy link
Collaborator Author

That's something that should probably be changed as well anyways: HTTP responses should only contain something like "error while processing request, check server logs for details".

@yhabteab yhabteab self-assigned this Nov 22, 2023
@yhabteab yhabteab linked a pull request Nov 22, 2023 that will close this issue
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 a pull request may close this issue.

2 participants