Skip to content

custom error enums for state and token methods #22

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 21, 2022
Merged

Conversation

alexytsu
Copy link
Collaborator

Replaces use internal use of anyhow with custom error structs

The fvm_ipld_blockstore::Blockstore trait depends exports an interface with anyhow::Result so it can't be dropped as a dependency for now.

@alexytsu
Copy link
Collaborator Author

Closes #15

Copy link
Member

@anorth anorth left a comment

Choose a reason for hiding this comment

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

Great that you got a net negative lines of code with this, too.

#[error("underlying serialization error: {0}")]
Serialization(String),
#[error(
"negative balance caused by subtracting {delta:?} from {owner:?}'s balance of {balance:?}"
Copy link
Member

Choose a reason for hiding this comment

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

The delta here will be negative when subtracting, so this double negative will be confusing.

Instead: "negative balance caused by adding -1000 to owner's balance of 200". Or "changing balance by xxx"

@alexytsu alexytsu merged commit 19958c0 into main Jul 21, 2022
@alexytsu alexytsu deleted the token/errors branch July 21, 2022 01:02
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