From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web11.3312.1589586256105336700 for ; Fri, 15 May 2020 16:44:16 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.126, mailfrom: ashley.e.desimone@intel.com) IronPort-SDR: hsO6wMJFrrEe0mNkGeMUxenAlsFv3L9ZpGBwPND0at5/BINRVIAMjEZ8gYWtjI14GB5Odzm0lW /SruirZYSj5w== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 May 2020 16:44:15 -0700 IronPort-SDR: 0ZAV1XFIENVMlUb0cKeiVifYdpYOTgbArS6+YkSc5WZFkKWcXiTy8c407wcT5M5reCUxwzEp/8 VSs7eksCUu5w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,396,1583222400"; d="scan'208";a="465093202" Received: from aedesimo-desk.amr.corp.intel.com ([10.212.18.166]) by fmsmga006.fm.intel.com with ESMTP; 15 May 2020 16:44:14 -0700 From: "Ashley E Desimone" To: devel@edk2.groups.io Cc: Nate DeSimone , Puja Pandya , Erik Bjorge , Bret Barkelew , Prince Agyeman Subject: [edk2-staging/EdkRepo] [PATCH] EdkRepo: Improve clone error handling. Date: Fri, 15 May 2020 16:44:12 -0700 Message-Id: <20200515234412.18064-1-ashley.e.desimone@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 Raise an invalid parameters exception when a project is not found. Signed-off-by: Ashley E Desimone Cc: Nate DeSimone Cc: Puja Pandya Cc: Erik Bjorge Cc: Bret Barkelew Cc: Prince Agyeman --- edkrepo/commands/clone_command.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/edkrepo/commands/clone_command.py b/edkrepo/commands/clone_command.py index 179aaf7..3f2e6e1 100644 --- a/edkrepo/commands/clone_command.py +++ b/edkrepo/commands/clone_command.py @@ -17,6 +17,7 @@ from edkrepo.common.common_repo_functions import clone_repos, sparse_checkout, v from edkrepo.common.common_repo_functions import update_editor_config, combinations_in_manifest from edkrepo.common.common_repo_functions import write_included_config, write_conditional_include from edkrepo.common.edkrepo_exception import EdkrepoInvalidParametersException, EdkrepoManifestInvalidException +from edkrepo.common.edkrepo_exception import EdkrepoManifestNotFoundException from edkrepo.common.humble import CLONE_INVALID_WORKSPACE, CLONE_INVALID_PROJECT_ARG, CLONE_INVALID_COMBO_ARG from edkrepo.common.humble import SPARSE_CHECKOUT, CLONE_INVALID_LOCAL_ROOTS from edkrepo.common.workspace_maintenance.workspace_maintenance import case_insensitive_single_match @@ -81,12 +82,15 @@ class CloneCommand(EdkrepoCommand): os.makedirs(workspace_dir) cfg, user_cfg, conflicts = list_available_manifest_repos(config['cfg_file'], config['user_cfg_file']) - manifest_repo, source_cfg, global_manifest_path = find_project_in_all_indices(args.ProjectNameOrManifestFile, - config['cfg_file'], - config['user_cfg_file'], - PROJ_NOT_IN_REPO.format(args.ProjectNameOrManifestFile), - SOURCE_MANIFEST_REPO_NOT_FOUND.format(args.ProjectNameOrManifestFile), - args.source_manifest_repo) + try: + manifest_repo, source_cfg, global_manifest_path = find_project_in_all_indices(args.ProjectNameOrManifestFile, + config['cfg_file'], + config['user_cfg_file'], + PROJ_NOT_IN_REPO.format(args.ProjectNameOrManifestFile), + SOURCE_MANIFEST_REPO_NOT_FOUND.format(args.ProjectNameOrManifestFile), + args.source_manifest_repo) + except EdkrepoManifestNotFoundException: + raise EdkrepoInvalidParametersException(CLONE_INVALID_PROJECT_ARG) # If this manifest is in a defined manifest repository validate the manifest within the manifest repo if manifest_repo in cfg: -- 2.16.2.windows.1