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

Adding recover functionality #3964

Open
Alexnerotd opened this issue Sep 20, 2024 · 1 comment
Open

Adding recover functionality #3964

Alexnerotd opened this issue Sep 20, 2024 · 1 comment
Assignees
Labels
awaiting user waiting for user to respond feature

Comments

@Alexnerotd
Copy link

Feature Description

Reviewing the code, in the api/v1/errors.go section,
I noticed that in the apiError function, you are using a panic() function, as a return in case an error occurs converting to JSON using json.Marshal(), but in the api/v1/groupe_routes.go file, I don't see that you are handling that panic().

Suggested Solution (optional)

My suggestion is to add a recover() function, to handle the error returned by the panic() function, that way we will be using the functionality for which this function was created.

In any case, if you do not want to make that change, I suggest changing the panic() function to log.fatal(), since you do not handle a recover() with panic() anyway.

Already existing or connected issues / PRs (optional)

No response

@mstoykov
Copy link
Contributor

Hi @Alexnerotd - have you actually hit this as an issue ?

This code has been around since 2017 and given that the net/http server already recovers from panics, this doesn't seem relevant unless there is a concrete case where this is a problem

@mstoykov mstoykov added awaiting user waiting for user to respond and removed triage labels Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting user waiting for user to respond feature
Projects
None yet
Development

No branches or pull requests

2 participants