From 3ec774946c7a581f4a0bf16de9e38ad177dfba66 Mon Sep 17 00:00:00 2001 From: Aradhya Date: Wed, 23 Mar 2022 18:22:54 +0530 Subject: [PATCH] refactor: Appropriate message for invalid version --- bench/utils/app.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bench/utils/app.py b/bench/utils/app.py index 434af655..98c53514 100644 --- a/bench/utils/app.py +++ b/bench/utils/app.py @@ -7,6 +7,7 @@ from bench.exceptions import ( InvalidRemoteException, InvalidBranchException, CommandFailedError, + VersionNotFound, ) from bench.app import get_repo_dir @@ -109,7 +110,7 @@ def switch_to_develop(apps=None, bench_path=".", upgrade=True): def get_version_from_string(contents, field="__version__"): match = re.search(r"^(\s*%s\s*=\s*['\\\"])(.+?)(['\"])" % field, contents, flags=(re.S | re.M)) if not match: - raise Exception("No match was found") + raise VersionNotFound(f"{contents} is not a valid version") return match.group(2)