mirror of
https://github.com/frappe/bench.git
synced 2025-01-23 15:08:24 +00:00
refactor: Added messages on invalid remote exceptions
This commit is contained in:
parent
ddd498ebd0
commit
cd583f7822
@ -66,7 +66,7 @@ def is_valid_frappe_branch(frappe_path:str, frappe_branch:str):
|
||||
try:
|
||||
owner, repo = frappe_path.split("/")[3], frappe_path.split("/")[4]
|
||||
except IndexError:
|
||||
raise InvalidRemoteException
|
||||
raise InvalidRemoteException("Invalid git url")
|
||||
git_api_req = f"https://api.github.com/repos/{owner}/{repo}/branches"
|
||||
res = requests.get(git_api_req).json()
|
||||
|
||||
@ -74,10 +74,10 @@ def is_valid_frappe_branch(frappe_path:str, frappe_branch:str):
|
||||
# slower alternative with no rate limit
|
||||
github_req = f'https://github.com/{owner}/{repo}/tree/{frappe_branch}'
|
||||
if requests.get(github_req).status_code != 200:
|
||||
raise InvalidRemoteException
|
||||
raise InvalidRemoteException("Invalid git url")
|
||||
|
||||
elif frappe_branch not in [x["name"] for x in res]:
|
||||
raise InvalidRemoteException
|
||||
raise InvalidRemoteException("Frappe branch does not exist")
|
||||
|
||||
|
||||
def log(message, level=0, no_log=False):
|
||||
|
Loading…
x
Reference in New Issue
Block a user