chore: Improve error handling and logging in commit.py and git_api.py
This commit is contained in:
parent
2f3a423741
commit
4b6827d0f9
@ -73,13 +73,16 @@ def read_prompt_from_file(filename):
|
|||||||
with open(filename, "r", encoding="utf-8") as file:
|
with open(filename, "r", encoding="utf-8") as file:
|
||||||
return file.read().strip()
|
return file.read().strip()
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
IDEService().log_info(
|
IDEService().ide_logging(
|
||||||
|
"error",
|
||||||
f"File {filename} not found. "
|
f"File {filename} not found. "
|
||||||
"Please make sure it exists in the same directory as the script."
|
"Please make sure it exists in the same directory as the script.",
|
||||||
)
|
)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
IDEService().log_info(f"An error occurred while reading the file {filename}: {e}")
|
IDEService().ide_logging(
|
||||||
|
"error", f"An error occurred while reading the file {filename}: {e}"
|
||||||
|
)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import time
|
|||||||
import requests
|
import requests
|
||||||
|
|
||||||
from lib.chatmark import TextEditor
|
from lib.chatmark import TextEditor
|
||||||
|
from lib.ide_service import IDEService
|
||||||
|
|
||||||
|
|
||||||
def read_github_token():
|
def read_github_token():
|
||||||
@ -188,7 +189,7 @@ def get_github_repo(issue_repo=False):
|
|||||||
repo = parts[-1].replace(".git", "")
|
repo = parts[-1].replace(".git", "")
|
||||||
username = parts[-2].split(":")[-1]
|
username = parts[-2].split(":")[-1]
|
||||||
github_repo = f"{username}/{repo}"
|
github_repo = f"{username}/{repo}"
|
||||||
print("current github repo:", github_repo, end="\n\n", file=sys.stderr, flush=True)
|
IDEService().ide_logging("debug", f"current github repo: {github_repo}")
|
||||||
return github_repo
|
return github_repo
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
print(e)
|
print(e)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user