mirror of
https://github.com/karma-riuk/crab.git
synced 2025-07-05 05:28:13 +02:00
added try catch for unexepected exception
This commit is contained in:
@ -3,7 +3,7 @@ from typing import Any, Callable, Optional
|
|||||||
from github.PullRequest import PullRequest
|
from github.PullRequest import PullRequest
|
||||||
from github.Repository import Repository
|
from github.Repository import Repository
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
from github import Github
|
from github import Github, GithubException
|
||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
@ -82,7 +82,10 @@ def process_pull(repo: Repository, pr: PullRequest, dataset: Dataset, repos_dir:
|
|||||||
first_commit = commits[0]
|
first_commit = commits[0]
|
||||||
last_commit = commits[-1]
|
last_commit = commits[-1]
|
||||||
|
|
||||||
diffs_before = {file.filename: file.patch for file in repo.compare(pr.base.sha, first_commit.sha).files}
|
try:
|
||||||
|
diffs_before = {file.filename: file.patch for file in repo.compare(pr.base.sha, first_commit.sha).files}
|
||||||
|
except GithubException as e:
|
||||||
|
return
|
||||||
|
|
||||||
comments = list(pr.get_review_comments())
|
comments = list(pr.get_review_comments())
|
||||||
assert len(comments) == 1
|
assert len(comments) == 1
|
||||||
@ -90,7 +93,11 @@ def process_pull(repo: Repository, pr: PullRequest, dataset: Dataset, repos_dir:
|
|||||||
comment_text = comment.body
|
comment_text = comment.body
|
||||||
commented_file_path = comment.path
|
commented_file_path = comment.path
|
||||||
|
|
||||||
diffs_after = {file.filename: file.patch for file in repo.compare(first_commit.sha, last_commit.sha).files}
|
try:
|
||||||
|
diffs_after = {file.filename: file.patch for file in repo.compare(first_commit.sha, last_commit.sha).files}
|
||||||
|
except GithubException as e:
|
||||||
|
return
|
||||||
|
|
||||||
entry = DatasetEntry(
|
entry = DatasetEntry(
|
||||||
metadata=Metadata(repo.full_name, pr.number, pr.merge_commit_sha, commented_file_path, reason_for_failure="Was still being processed"),
|
metadata=Metadata(repo.full_name, pr.number, pr.merge_commit_sha, commented_file_path, reason_for_failure="Was still being processed"),
|
||||||
files={file.filename: FileData(file.filename) for file in pr.get_files()},
|
files={file.filename: FileData(file.filename) for file in pr.get_files()},
|
||||||
|
Reference in New Issue
Block a user