Return OutOfRange instead of StarknetApiError whenever a method can only return OutOfRange#174
Open
ShahakShama wants to merge 1 commit intomainfrom
Open
Return OutOfRange instead of StarknetApiError whenever a method can only return OutOfRange#174ShahakShama wants to merge 1 commit intomainfrom
ShahakShama wants to merge 1 commit intomainfrom
Conversation
…nly return OutOfRange
ShahakShama
commented
Feb 4, 2024
Contributor
Author
ShahakShama
left a comment
There was a problem hiding this comment.
+reviewer:@giladchase
Reviewable status: 0 of 7 files reviewed, all discussions resolved (waiting on @giladchase, @nagmo-starkware, and @yair-starkware)
giladchase
approved these changes
Mar 28, 2024
Contributor
giladchase
left a comment
There was a problem hiding this comment.
Reviewed 7 of 7 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @nagmo-starkware, @ShahakShama, and @yair-starkware)
src/lib.rs line 41 at r1 (raw file):
pub struct OutOfRangeError { string: String, }
"out of error" string is redundant, it appears in the variant.
string field also not necessary I think, it is clear what the string means.
Suggestion:
#[error("{0}")]
pub struct OutOfRangeError(String)src/lib.rs line 47 at r1 (raw file):
Self::OutOfRange(error) } }
i think that #[from] generates the code removed
Suggestion:
#[error(transparent)]
OutOfRange(#[from] OutOfRangeError),
/// Error when serializing into number.
#[error(transparent)]
ParseIntError(#[from] ParseIntError),
/// Missing resource type / duplicated resource type.
#[error("Missing resource type / duplicated resource type; got {0}.")]
InvalidResourceMappingInitializer(String),
}
#[derive(thiserror::Error, Clone, Debug)]
#[error("Out of range {string}.")]
pub struct OutOfRangeError {
string: String,
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change is