From e7a4931d3768004e12679072b27cd5982d481d48 Mon Sep 17 00:00:00 2001 From: Marcel Santee <47259357+SanteeMarcel@users.noreply.github.com> Date: Tue, 22 Apr 2025 14:15:23 -0300 Subject: [PATCH] improve error raising --- utils/crawl_github_files.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/utils/crawl_github_files.py b/utils/crawl_github_files.py index 23e394a..9c32f19 100644 --- a/utils/crawl_github_files.py +++ b/utils/crawl_github_files.py @@ -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]}...") \ No newline at end of file + print(f"Content preview: {files[sample_file][:200]}...")