Port try macro to new ? operator. (#3962)

* initial untry sweep

* restore try in ipc codegen, fix inference

* change a few missed try instances
This commit is contained in:
Robert Habermeier
2016-12-27 12:53:56 +01:00
committed by Arkadiy Paronyan
parent b1ef52a6d7
commit 8125b5690c
165 changed files with 1696 additions and 1696 deletions

View File

@@ -68,9 +68,9 @@ impl Handler for RpcHandler {
fn build_request(&mut self, url: &Url) -> WsResult<Request> {
match Request::from_url(url) {
Ok(mut r) => {
let timestamp = try!(time::UNIX_EPOCH.elapsed().map_err(|err| {
let timestamp = time::UNIX_EPOCH.elapsed().map_err(|err| {
WsError::new(WsErrorKind::Internal, format!("{}", err))
}));
})?;
let secs = timestamp.as_secs();
let hashed = format!("{}:{}", self.auth_code, secs).sha3();
let proto = format!("{:?}_{}", hashed, secs);
@@ -195,7 +195,7 @@ pub struct Rpc {
impl Rpc {
/// Blocking, returns a new initialized connection or RpcError
pub fn new(url: &str, authpath: &PathBuf) -> Result<Self, RpcError> {
let rpc = try!(Self::connect(url, authpath).map(|rpc| rpc).wait());
let rpc = Self::connect(url, authpath).map(|rpc| rpc).wait()?;
rpc
}
/// Non-blocking, returns a future
@@ -260,7 +260,7 @@ impl Rpc {
p.map(|result| {
match result {
Ok(json) => {
let t: T = try!(json::from_value(json));
let t: T = json::from_value(json)?;
Ok(t)
},
Err(err) => Err(err)

View File

@@ -10,7 +10,7 @@ pub struct SignerRpc {
impl SignerRpc {
pub fn new(url: &str, authfile: &PathBuf) -> Result<Self, RpcError> {
Ok(SignerRpc { rpc: try!(Rpc::new(&url, authfile)) })
Ok(SignerRpc { rpc: Rpc::new(&url, authfile)? })
}
pub fn requests_to_confirm(&mut self) ->
BoxFuture<Result<Vec<ConfirmationRequest>, RpcError>, Canceled>