diff --git a/crates/aptos/CHANGELOG.md b/crates/aptos/CHANGELOG.md index f3cf4e1a38c47..ce986951fac0c 100644 --- a/crates/aptos/CHANGELOG.md +++ b/crates/aptos/CHANGELOG.md @@ -3,6 +3,7 @@ All notable changes to the Aptos CLI will be captured in this file. This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) and the format set out by [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## Unreleased +- [`Fix`] Remove unwraps to make outputs go through regular error handling ## [4.2.5] - 2024/10/23 - Bump to resolve issue with release version inconsistency. diff --git a/crates/aptos/src/move_tool/fmt.rs b/crates/aptos/src/move_tool/fmt.rs index 995a79efd3e40..c3d7b8d34f68c 100644 --- a/crates/aptos/src/move_tool/fmt.rs +++ b/crates/aptos/src/move_tool/fmt.rs @@ -113,7 +113,7 @@ impl FmtCommand { } else { None }; - let package_path = dir_default_to_current(package_opt.clone()).unwrap(); + let package_path = dir_default_to_current(package_opt.clone())?; let root_res = SourcePackageLayout::try_find_root(&package_path.clone()); if let Ok(root_package_path) = root_res { let mut path_vec = vec![]; diff --git a/crates/aptos/src/move_tool/mod.rs b/crates/aptos/src/move_tool/mod.rs index e9dabe23e3968..87959c5785e2e 100644 --- a/crates/aptos/src/move_tool/mod.rs +++ b/crates/aptos/src/move_tool/mod.rs @@ -784,8 +784,7 @@ impl TryInto for &PublishPackage { type Error = CliError; fn try_into(self) -> Result { - let package = - build_package_options(&self.move_options, &self.included_artifacts_args).unwrap(); + let package = build_package_options(&self.move_options, &self.included_artifacts_args)?; let package_publication_data = create_package_publication_data(package, PublishType::AccountDeploy, None)?; @@ -815,8 +814,7 @@ impl AsyncTryInto for &PublishPackage { type Error = CliError; async fn async_try_into(self) -> Result { - let package = - build_package_options(&self.move_options, &self.included_artifacts_args).unwrap(); + let package = build_package_options(&self.move_options, &self.included_artifacts_args)?; let chunked_publish_payloads = create_chunked_publish_payloads(package, PublishType::AccountDeploy, None)?; @@ -1146,8 +1144,7 @@ impl CliCommand for CreateObjectAndPublishPackage { let mock_object_address = AccountAddress::from_hex_literal("0xcafe").unwrap(); self.move_options .add_named_address(self.address_name.clone(), mock_object_address.to_string()); - let package = - build_package_options(&self.move_options, &self.included_artifacts_args).unwrap(); + let package = build_package_options(&self.move_options, &self.included_artifacts_args)?; let mock_payloads = create_chunked_publish_payloads(package, PublishType::AccountDeploy, None)? .payloads; @@ -1162,8 +1159,7 @@ impl CliCommand for CreateObjectAndPublishPackage { self.move_options .add_named_address(self.address_name, object_address.to_string()); - let package = - build_package_options(&self.move_options, &self.included_artifacts_args).unwrap(); + let package = build_package_options(&self.move_options, &self.included_artifacts_args)?; let message = format!( "Do you want to publish this package at object address {}", object_address @@ -1246,7 +1242,7 @@ impl CliCommand for UpgradeObjectPackage { async fn execute(self) -> CliTypedResult { let built_package = - build_package_options(&self.move_options, &self.included_artifacts_args).unwrap(); + build_package_options(&self.move_options, &self.included_artifacts_args)?; let url = self .txn_options .rest_options @@ -1357,8 +1353,7 @@ impl CliCommand for DeployObjectCode { let mock_object_address = AccountAddress::from_hex_literal("0xcafe").unwrap(); self.move_options .add_named_address(self.address_name.clone(), mock_object_address.to_string()); - let package = - build_package_options(&self.move_options, &self.included_artifacts_args).unwrap(); + let package = build_package_options(&self.move_options, &self.included_artifacts_args)?; let mock_payloads = create_chunked_publish_payloads(package, PublishType::AccountDeploy, None)? .payloads; @@ -1373,8 +1368,7 @@ impl CliCommand for DeployObjectCode { self.move_options .add_named_address(self.address_name, object_address.to_string()); - let package = - build_package_options(&self.move_options, &self.included_artifacts_args).unwrap(); + let package = build_package_options(&self.move_options, &self.included_artifacts_args)?; let message = format!( "Do you want to deploy this package at object address {}", object_address @@ -1463,8 +1457,7 @@ impl CliCommand for UpgradeCodeObject { self.move_options .add_named_address(self.address_name, self.object_address.to_string()); - let package = - build_package_options(&self.move_options, &self.included_artifacts_args).unwrap(); + let package = build_package_options(&self.move_options, &self.included_artifacts_args)?; let url = self .txn_options .rest_options