We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
_:hammer_and_wrench: Refactor suggestion_
Consider implementing proper error handling instead of using expect.
expect
The current implementation uses expect which could cause panic in a library context. Consider propagating errors instead:
- pub fn register_service_with_random_keys( - &mut self, - algorithm: KeyAlgorithm, - id: &str, - ) -> UncommittedTransaction { - let random_service_challenge_key = SigningKey::new_with_algorithm(algorithm).expect("Failed to create challenge key"); - let random_service_signing_key = SigningKey::new_with_algorithm(algorithm).expect("Failed to create signing key"); + pub fn register_service_with_random_keys( + &mut self, + algorithm: KeyAlgorithm, + id: &str, + ) -> Result<UncommittedTransaction, Box<dyn std::error::Error>> { + let random_service_challenge_key = SigningKey::new_with_algorithm(algorithm) + .map_err(|e| format!("Failed to create challenge key: {}", e))?; + let random_service_signing_key = SigningKey::new_with_algorithm(algorithm) + .map_err(|e| format!("Failed to create signing key: {}", e))?; + Ok(self.register_service(id, random_service_challenge_key, random_service_signing_key))
Committable suggestion skipped: line range outside the PR's diff.
Originally posted by @coderabbitai[bot] in #186 (comment)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Consider implementing proper error handling instead of using
expect
.The current implementation uses
expect
which could cause panic in a library context. Consider propagating errors instead:Originally posted by @coderabbitai[bot] in #186 (comment)
The text was updated successfully, but these errors were encountered: