|
43 | 43 | BASE_URL = 'https://api.github.com' # Base URL for GitHub API |
44 | 44 | GITHUB_API_URL = '' # Dynamically constructed API URL for the specific repository |
45 | 45 |
|
46 | | -logging.set_verbosity(logging.INFO) |
| 46 | +logging.set_verbosity(logging.WARNING) |
47 | 47 |
|
48 | 48 |
|
49 | 49 | def set_repo_url_standalone(owner_name, repo_name): |
@@ -105,7 +105,7 @@ def get_pull_request_review_comments(token, pull_number, since=None): |
105 | 105 |
|
106 | 106 | except requests.exceptions.RequestException as e: |
107 | 107 | logging.error(f"Error fetching review comments (page {page}, params: {current_page_params}) for PR {pull_number}: {e}") |
108 | | - break |
| 108 | + return None # Indicate error |
109 | 109 | return results |
110 | 110 |
|
111 | 111 |
|
@@ -136,7 +136,7 @@ def list_pull_requests(token, state, head, base): |
136 | 136 | keep_going = (len(current_page_results) == per_page) |
137 | 137 | except requests.exceptions.RequestException as e: |
138 | 138 | logging.error(f"Error listing pull requests (page {params.get('page', 'N/A')}, params: {params}) for {OWNER}/{REPO}: {e}") |
139 | | - break |
| 139 | + return None # Indicate error |
140 | 140 | return results |
141 | 141 |
|
142 | 142 |
|
@@ -354,9 +354,12 @@ def parse_repo_url(url_string): |
354 | 354 | since=args.since |
355 | 355 | ) |
356 | 356 |
|
357 | | - if not comments: |
358 | | - sys.stderr.write(f"No review comments found for PR #{pull_request_number} (or matching filters), or an error occurred.\n") |
359 | | - return |
| 357 | + if comments is None: # Explicit check for None, indicating an API/network error |
| 358 | + sys.stderr.write(f"Error: Failed to fetch review comments due to an API or network issue.{error_suffix}\nPlease check logs for details.\n") |
| 359 | + sys.exit(1) |
| 360 | + elif not comments: # Empty list, meaning no comments found or matching filters |
| 361 | + sys.stderr.write(f"No review comments found for PR #{pull_request_number} (or matching filters).\n") |
| 362 | + return # Graceful exit with 0 |
360 | 363 |
|
361 | 364 | latest_activity_timestamp_obj = None |
362 | 365 | processed_comments_count = 0 |
|
0 commit comments