-
Notifications
You must be signed in to change notification settings - Fork 294
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: improve error handling in LoadTxInfo #1571
base: v0.34.x-celestia
Are you sure you want to change the base?
refactor: improve error handling in LoadTxInfo #1571
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall I'm a fan of replacing panic
s with errors so thanks!
What motivated this PR? Is this related to a GitHub issue in the repo?
Before approving, it would be nice to add some unit tests that check for the new errors.
store/store.go
Outdated
} | ||
if len(bz) == 0 { | ||
return nil | ||
return nil, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[question] should we return an error in this situation? Also needs a unit test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think it makes consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still doesn't return an error. should it?
Yeah, i want to improve codebase |
I'll fixed test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding unit test! One last question about returning (nil, nil)
instead of an error for the not found case.
store/store.go
Outdated
} | ||
if len(bz) == 0 { | ||
return nil | ||
return nil, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still doesn't return an error. should it?
Hi @rootulp, thank you for reviewing my PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Build is failing
Description
Improve error handling in LoadTxInfo
Replace panic with proper error returns in LoadTxInfo function to follow Go's
error handling conventions. This change:
This is part of an ongoing effort to improve error handling patterns in the
codebase.
PR checklist
.changelog
(we useunclog to manage our changelog)
docs/
orspec/
) and code comments