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: removed panic from Signature::from_str #878

Open
wants to merge 1 commit into
base: testnet3
Choose a base branch
from

Conversation

sabsubsib
Copy link

Motivation

The change from .unwrap() to ? in the from_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 to unwrap() 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:

  1. Manually tested the from_str method by providing both valid and invalid strings to verify that it returns the correct Result type.
  2. Checked that valid strings are parsed successfully and return Ok(Self) as expected.
  3. Verified that invalid strings now result in an error being returned instead of causing a panic, confirming that the ? operator is correctly propagating errors.
  4. Ensured that the overall application compiles without any errors after the modification.

Related PRs

This change does not depend on any other PRs and does not have any related PRs as of now.

Signed-off-by: sabsubsib <74819934+sabsubsib@users.noreply.github.com>
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.

None yet

1 participant