Merge pull request #112 from devchat-ai/remove_github_logging
chore: Improve error handling and logging in commit.py and git_api.py
This commit is contained in:
commit
da12ac1fb9
@ -73,13 +73,16 @@ def read_prompt_from_file(filename):
|
||||
with open(filename, "r", encoding="utf-8") as file:
|
||||
return file.read().strip()
|
||||
except FileNotFoundError:
|
||||
IDEService().log_info(
|
||||
IDEService().ide_logging(
|
||||
"error",
|
||||
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)
|
||||
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)
|
||||
|
||||
|
||||
|
@ -7,6 +7,7 @@ import time
|
||||
import requests
|
||||
|
||||
from lib.chatmark import TextEditor
|
||||
from lib.ide_service import IDEService
|
||||
|
||||
|
||||
def read_github_token():
|
||||
@ -188,7 +189,7 @@ def get_github_repo(issue_repo=False):
|
||||
repo = parts[-1].replace(".git", "")
|
||||
username = parts[-2].split(":")[-1]
|
||||
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
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(e)
|
||||
|
Loading…
x
Reference in New Issue
Block a user