Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
eftychis committed Nov 19, 2019
1 parent 0e04089 commit 2f2f7e5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
8 changes: 3 additions & 5 deletions dfx/src/commands/canister/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<CanisterId>()
.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())
})?;
Expand Down
8 changes: 3 additions & 5 deletions dfx/src/commands/canister/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<CanisterId>()
.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()))?;
Expand Down

0 comments on commit 2f2f7e5

Please sign in to comment.