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

refactor: add sdk.LogDeferred to report errors in defers #13619

Merged
merged 15 commits into from
Oct 26, 2022

Conversation

leoflalv
Copy link
Contributor

@leoflalv leoflalv commented Oct 22, 2022

Description

Closes: #11785

A new helper function called LogDeferred was added. This function it's used to report errors in defer section. It was added in defer statements of x/bank folder.

Author Checklist

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@leoflalv leoflalv requested a review from a team as a code owner October 22, 2022 23:33
@leoflalv leoflalv marked this pull request as draft October 22, 2022 23:34
@leoflalv leoflalv marked this pull request as ready for review October 22, 2022 23:42
internal/util.go Outdated Show resolved Hide resolved
@alexanderbez
Copy link
Contributor

There's technically nothing about LogDeferred that implies a defer is necessary or even used, but I suppose that's fine.

@codecov
Copy link

codecov bot commented Oct 24, 2022

Codecov Report

Merging #13619 (a99f0f3) into main (e2b5cac) will increase coverage by 0.02%.
The diff coverage is 70.58%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #13619      +/-   ##
==========================================
+ Coverage   54.81%   54.83%   +0.02%     
==========================================
  Files         647      647              
  Lines       55797    55794       -3     
==========================================
+ Hits        30586    30597      +11     
+ Misses      22720    22705      -15     
- Partials     2491     2492       +1     
Impacted Files Coverage Δ
types/utils.go 85.18% <0.00%> (-4.43%) ⬇️
x/bank/keeper/keeper.go 75.41% <50.00%> (+0.16%) ⬆️
x/bank/keeper/send.go 80.40% <100.00%> (-0.07%) ⬇️
x/bank/keeper/view.go 79.25% <100.00%> (-0.16%) ⬇️
x/bank/migrations/v2/store.go 78.04% <100.00%> (-0.27%) ⬇️
x/bank/migrations/v3/store.go 74.13% <100.00%> (-0.87%) ⬇️
crypto/keys/internal/ecdsa/privkey.go 81.13% <0.00%> (-1.89%) ⬇️
... and 3 more

@julienrbrt
Copy link
Member

julienrbrt commented Oct 25, 2022

There's technically nothing about LogDeferred that implies a defer is necessary or even used, but I suppose that's fine.

+1 This helper just logs the error of any given function. Maybe a clearer name would be good, LogError might be too generic but at least it says exactly what the function does.

@facundomedica facundomedica enabled auto-merge (squash) October 26, 2022 14:42
@julienrbrt julienrbrt changed the title refactor: add new function to report errors in defers refactor: add sdk.LogDeferred to report errors in defers Oct 26, 2022
@julienrbrt julienrbrt added the A:automerge Automatically merge PR once all prerequisites pass. label Oct 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:automerge Automatically merge PR once all prerequisites pass. C:x/bank
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Report errors in Close() defer functions
4 participants