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

Fix/wrong cf on write to vault #253

Merged
merged 4 commits into from
Aug 30, 2021
Merged

Conversation

felsweg-iota
Copy link
Contributor

Description of change

This PR corrects a wrong control flow in client/src/write_to_vault, that always returned an error even if the operation was successful.

Links to any relevant issues

none.

Type of change

Choose a type of change, and delete any options that are not relevant.

  • Bug fix (a non-breaking change which fixes an issue)

How the change has been tested

client/src/tests/interface_tests.rs have been extended to detect this kind of behavior.

Change checklist

Add an x to the boxes that are relevant to your changes, and delete any items that are not.

  • I have followed the contribution guidelines for this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Copy link
Contributor

@elenaf9 elenaf9 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 to me. Just a minor nitpick on the result matching, to avoid the unwrap.

client/src/interface.rs Outdated Show resolved Hide resolved
Comment on lines +199 to +203
if result.is_ok() {
return StatusMessage::OK;
} else {
return StatusMessage::Error(result.err().unwrap().to_string());
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if result.is_ok() {
return StatusMessage::OK;
} else {
return StatusMessage::Error(result.err().unwrap().to_string());
}
return match result {
Ok(_) => StatusMessage::OK,
Err(e) => StatusMessage::Error(e.to_string()),
};

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.

2 participants