-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Return unwrapped
ErrorExt
in crypto constructors.
More precise errors for caller, with the cost of manual casting into `CryptoError` in handlers.
- Loading branch information
Showing
5 changed files
with
14 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,11 @@ | ||
use std::path::Path; | ||
|
||
use super::error::CryptoError; | ||
use casper_types::ErrorExt; | ||
|
||
pub struct CasperPrivateKey(pub casper_types::SecretKey); | ||
|
||
impl CasperPrivateKey { | ||
pub fn from_file<P: AsRef<Path>>(file_path: P) -> Result<Self, CryptoError> { | ||
casper_types::SecretKey::from_file(file_path) | ||
.map(Self) | ||
.map_err(|error| error.into()) | ||
pub fn from_file<P: AsRef<Path>>(file_path: P) -> Result<Self, ErrorExt> { | ||
casper_types::SecretKey::from_file(file_path).map(Self) | ||
} | ||
} |
This file contains 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