From 4607022a745aa247fb9fd1ba6bf3804370c9ea02 Mon Sep 17 00:00:00 2001 From: Ankit R Gadiya Date: Tue, 23 Nov 2021 17:57:40 +0530 Subject: [PATCH] fix(package): fixes handling for wrong name The @name_to_guid decorator didn't handle the case when valid package is not found based on the name. This commit fixes the behaviour by erroring out explicitly. --- riocli/package/util.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/riocli/package/util.py b/riocli/package/util.py index 9ae81671..86d8ec9b 100644 --- a/riocli/package/util.py +++ b/riocli/package/util.py @@ -58,6 +58,10 @@ def get_package_name(client: Client, guid: str) -> str: def find_package_guid(client: Client, name: str, version: str = None) -> str: packages = client.get_all_packages(name=name, version=version) + if len(packages) == 0: + click.secho("package not found", fg='red') + exit(1) + if len(packages) == 1: return packages[0].packageId