fix: removed panic from Signature::from_str #878
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.
Motivation
The change from
.unwrap()
to?
in thefrom_str
function improves the error handling mechanism of our code. By using?
, we ensure that any errors that occur during the string parsing are properly propagated up the call stack, allowing for more graceful error handling and better debugging. This avoids potential panics at runtime due tounwrap()
and adheres to best practices in Rust for error handling.Test Plan
To ensure the changes work correctly, the following simple test plan was implemented:
from_str
method by providing both valid and invalid strings to verify that it returns the correctResult
type.Ok(Self)
as expected.?
operator is correctly propagating errors.Related PRs
This change does not depend on any other PRs and does not have any related PRs as of now.