Merge pull request #39 from SanteeMarcel/patch-1

improve error raising
This commit is contained in:
Zachary Huang
2025-04-22 18:26:03 -04:00
committed by GitHub
+4 -1
View File
@@ -173,6 +173,9 @@ def crawl_github_files(
if not token:
print(f"Error 404: Repository not found or is private.\n"
f"If this is a private repository, please provide a valid GitHub token via the 'token' argument or set the GITHUB_TOKEN environment variable.")
elif not path and ref == 'main':
print(f"Error 404: Repository not found. Check if the default branch is not 'main'\n"
f"Try adding branch name to the request i.e. python main.py --repo https://github.com/username/repo/tree/master")
else:
print(f"Error 404: Path '{path}' not found in repository or insufficient permissions with the provided token.\n"
f"Please verify the token has access to this repository and the path exists.")
@@ -309,4 +312,4 @@ if __name__ == "__main__":
if files:
sample_file = next(iter(files))
print(f"\nSample file: {sample_file}")
print(f"Content preview: {files[sample_file][:200]}...")
print(f"Content preview: {files[sample_file][:200]}...")