Skip to content

[HandleError] rename msg field to action #53

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

Merged
merged 2 commits into from
Jul 20, 2018
Merged

[HandleError] rename msg field to action #53

merged 2 commits into from
Jul 20, 2018

Conversation

savil
Copy link
Contributor

@savil savil commented Jul 20, 2018

this was a TODO and also briefly discussed in #43 (review)

I'm not fully sure how to remove the Option, and make it completely required. Would love suggestions. So, have omitted that for now. Plus, better to make smaller, incremental changes.

Test Plan:
cargo build
cargo test

src/ln/msgs.rs Outdated
@@ -380,7 +380,7 @@ pub enum ErrorAction {

pub struct HandleError { //TODO: rename me
pub err: &'static str,
pub msg: Option<ErrorAction>, //TODO: Make this required and rename it
pub action: Option<ErrorAction>, //TODO: Make this required and rename it
Copy link

Choose a reason for hiding this comment

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

Update the TODO maybe :)

Copy link
Collaborator

@TheBlueMatt TheBlueMatt left a comment

Choose a reason for hiding this comment

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

Looks good. Diff sucks, but I guess its best to get it over with earlier than later.

src/ln/msgs.rs Outdated
@@ -380,7 +380,7 @@ pub enum ErrorAction {

pub struct HandleError { //TODO: rename me
pub err: &'static str,
pub msg: Option<ErrorAction>, //TODO: Make this required and rename it
pub action: Option<ErrorAction>, //TODO: Make this required and rename it
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can remove the "rename it" TODO :)

@TheBlueMatt
Copy link
Collaborator

TheBlueMatt commented Jul 20, 2018

Note that "making it required" would be s/Option<ErrorAction>/ErrorAction/, but that will require filling in each action, which means figuring out exactly how we want to handle everything.

@ariard
Copy link

ariard commented Jul 20, 2018

To remove the Option I think we need to fulfill incrementally all empty msg field of HandleError with actual errors or futures ones (like BanPeer or KeyError). I'll try to clean others TODO errors in channelmanager after #43

savil added 2 commits July 19, 2018 20:01
this was a TODO and also briefly discussed in #43 (review)

I'm not fully sure how to remove the `Option`, and make it completely required. Would love suggestions. So, have omitted that for now. Plus, better to make smaller, incremental changes.

Test Plan:
`cargo build`
`cargo test`
@savil
Copy link
Contributor Author

savil commented Jul 20, 2018

  • cool, I updated the TODO. Let me know if anything else needs to be done.

  • sorry for the commit thrash, I'm still figuring out the workflow for pull-requests on GitHub. I think I messed up git history for this branch, trying to resolve a merge-conflict from upstream. I updated my local master from upstream, and then did git rebase master to resolve the conflict. Needed to git push -f origin <my branch>, but surely there's a better way that avoids using -f.

  • to remove Option, agree that it'll need to be incremental. I'm so new to this, I don't feel I have enough context on each call site to figure out what kind of Error to insert there.

@ariard
Copy link

ariard commented Jul 20, 2018

Have a look on Chap2,3,6 : http://labs.kernelconcepts.de/downloads/books/Pro%20Git%20-%20Scott%20Chacon.pdf ;)
You can squash your commits with git rebase -i HEAD~n (with n numbers of commits) to clean your git history.

Anyways don't hesitate to show up on IRC #rust-bitcoin, Freenode

@TheBlueMatt TheBlueMatt merged commit 4afb0d8 into lightningdevkit:master Jul 20, 2018
@TheBlueMatt
Copy link
Collaborator

No, force-pushing to a feature branch is generally fine, its only really bad practice on a master branch (though I use my own personal fork's master branch as a feature branch, too, just don't force push to rust-bitcoin/rust-lightning).

@savil savil deleted the rename-error-msg-to-action branch July 20, 2018 04:18
Copy link
Contributor Author

@savil savil left a comment

Choose a reason for hiding this comment

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

eh, forgot to submit this comment

@@ -380,7 +380,7 @@ pub enum ErrorAction {

pub struct HandleError { //TODO: rename me
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@TheBlueMatt off-topic to this diff, but since we're here: what's a better name for this? Would ErrorContext be more suitable?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm, I think eventually we need to separate out our error types, making this more of a MessageHandleError or PeerHandleError or something like that, and use a different type where that doesn't make sense.

carlaKC pushed a commit to carlaKC/rust-lightning that referenced this pull request Aug 9, 2023
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.

3 participants