mirror of
https://github.com/frappe/bench.git
synced 2025-01-24 07:28:25 +00:00
refactor: Appropriate message for invalid version
This commit is contained in:
parent
cd583f7822
commit
3ec774946c
@ -7,6 +7,7 @@ from bench.exceptions import (
|
|||||||
InvalidRemoteException,
|
InvalidRemoteException,
|
||||||
InvalidBranchException,
|
InvalidBranchException,
|
||||||
CommandFailedError,
|
CommandFailedError,
|
||||||
|
VersionNotFound,
|
||||||
)
|
)
|
||||||
from bench.app import get_repo_dir
|
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__"):
|
def get_version_from_string(contents, field="__version__"):
|
||||||
match = re.search(r"^(\s*%s\s*=\s*['\\\"])(.+?)(['\"])" % field, contents, flags=(re.S | re.M))
|
match = re.search(r"^(\s*%s\s*=\s*['\\\"])(.+?)(['\"])" % field, contents, flags=(re.S | re.M))
|
||||||
if not match:
|
if not match:
|
||||||
raise Exception("No match was found")
|
raise VersionNotFound(f"{contents} is not a valid version")
|
||||||
return match.group(2)
|
return match.group(2)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user