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

chore: Remove nolint:errcheck and instead handle errors #134

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vitsalis
Copy link
Member

@vitsalis vitsalis commented Oct 6, 2024

As we are adding static analyzers in the codebase, many of them will point out unhandled errors. If we add annotations to our codebase for each of them, this might bloat the codebase. Another approach is to only allow a single static analyzer fail about unhandled errors, while ignoring the rest.

In this PR, I opted to just handle the errors in a vanilla way to remove the nolint:errcheck from the annotations. The way the errors are handled for types.RegisterQueryHandlerClient was inspired by osmosis. Note though that Osmosis uses nolint:errcheck as well for the same function in other places.

@vitsalis vitsalis requested a review from a team as a code owner October 6, 2024 09:23
@vitsalis vitsalis requested review from gitferry and RafilxTenfen and removed request for a team October 6, 2024 09:23
crypto/schnorr-adaptor-signature/keys.go Outdated Show resolved Hide resolved
err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx))
if err != nil {
panic(err)
if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems we can panic here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought to keep it consistent with the other ones, this was the only instance that previously panicked. Should we panic on every one of them or just return? Osmosis seems to do the latter, so I followed their approach, but happy to change it if people think the other way is better.

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.

4 participants