diff --git a/infra/bisector.py b/infra/bisector.py index 4e88bd8e4..ff8366db7 100644 --- a/infra/bisector.py +++ b/infra/bisector.py @@ -59,6 +59,14 @@ END_MARKERS = [ DEDUP_TOKEN_MARKER = 'DEDUP_TOKEN:' +class BisectError(Exception): + """Bisection error.""" + + def __init__(self, message, repo_url): + super().__init__(message) + self.repo_url = repo_url + + def main(): """Finds the commit SHA where an error was initally introduced.""" logging.getLogger().setLevel(logging.INFO) @@ -218,14 +226,14 @@ def _bisect(bisect_type, old_commit, new_commit, test_case_path, fuzz_target, host_src_dir, build_data, base_builder_repo=base_builder_repo): - raise RuntimeError('Failed to build new_commit') + raise BisectError('Failed to build new_commit', repo_url) if bisect_type == 'fixed': should_crash = False elif bisect_type == 'regressed': should_crash = True else: - raise ValueError('Invalid bisect type ' + bisect_type) + raise BisectError('Invalid bisect type ' + bisect_type, repo_url) expected_error = _check_for_crash(build_data.project_name, fuzz_target, test_case_path) @@ -244,11 +252,11 @@ def _bisect(bisect_type, old_commit, new_commit, test_case_path, fuzz_target, host_src_dir, build_data, base_builder_repo=base_builder_repo): - raise RuntimeError('Failed to build old_commit') + raise BisectError('Failed to build old_commit', repo_url) if _check_for_crash(build_data.project_name, fuzz_target, test_case_path) == expected_error: - raise RuntimeError('old_commit had same result as new_commit') + raise BisectError('old_commit had same result as new_commit', repo_url) while old_idx - new_idx > 1: curr_idx = (old_idx + new_idx) // 2