From 2f2f7e5cd890e67c68e529a155230b7f253be7a2 Mon Sep 17 00:00:00 2001 From: eftychis Date: Mon, 18 Nov 2019 16:07:24 -0800 Subject: [PATCH] fix --- dfx/src/commands/canister/call.rs | 8 +++----- dfx/src/commands/canister/query.rs | 8 +++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/dfx/src/commands/canister/call.rs b/dfx/src/commands/canister/call.rs index 54d126f1a8..e9e7364b4b 100644 --- a/dfx/src/commands/canister/call.rs +++ b/dfx/src/commands/canister/call.rs @@ -55,11 +55,9 @@ where let canister_name = args.value_of("canister_name").unwrap(); let canister_info = CanisterInfo::load(config, canister_name)?; // Read the config. - let canister_id = args - .value_of("deployment_id") - .ok_or_else(|| DfxError::InvalidArgument("deployment_id".to_string()))? - .parse::() - .map_err(|e| DfxError::InvalidArgument(format!("invalid deployment_id: {}", e)))?; + let canister_id = canister_info.get_canister_id().ok_or_else(|| { + DfxError::CannotFindBuildOutputForCanister(canister_info.get_name().to_owned()) + })?; let method_name = args.value_of("method name").ok_or_else(|| { DfxError::InvalidArgument("method name argument provided invalid".to_string()) })?; diff --git a/dfx/src/commands/canister/query.rs b/dfx/src/commands/canister/query.rs index 28af91d5ca..e28b6e036e 100644 --- a/dfx/src/commands/canister/query.rs +++ b/dfx/src/commands/canister/query.rs @@ -49,11 +49,9 @@ where let canister_name = args.value_of("canister_name").unwrap(); let canister_info = CanisterInfo::load(config, canister_name)?; // Read the config. - let canister_id = args - .value_of("deployment_id") - .ok_or_else(|| DfxError::InvalidArgument("deployment id".to_string()))? - .parse::() - .map_err(|e| DfxError::InvalidArgument(format!("Invalid deployment ID: {}", e)))?; + let canister_id = canister_info.get_canister_id().ok_or_else(|| { + DfxError::CannotFindBuildOutputForCanister(canister_info.get_name().to_owned()) + })?; let method_name = args .value_of("method_name") .ok_or_else(|| DfxError::InvalidArgument("method name".to_string()))?;