From a4ce620aa0b333423b175be5f4c44fb7365a6065 Mon Sep 17 00:00:00 2001 From: Karma Riuk Date: Mon, 26 May 2025 11:36:04 +0200 Subject: [PATCH] printing stacktrace when error is made --- pull_requests.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pull_requests.py b/pull_requests.py index c61b3d5..c3c0321 100644 --- a/pull_requests.py +++ b/pull_requests.py @@ -1,5 +1,5 @@ from collections import defaultdict -import argparse, os, subprocess, docker, uuid +import argparse, os, subprocess, docker, uuid, sys, traceback from concurrent.futures import wait, FIRST_COMPLETED, ProcessPoolExecutor, Future from github.Commit import Commit from github.ContentFile import ContentFile @@ -448,7 +448,14 @@ def process_repo( ) # dataset.to_json(args.output) except Exception as e: - tqdm.write(f"[ERROR] PR #{pr.number} in {repo.full_name}. {type(e)}: {e}") + exc_type, _, exc_tb = sys.exc_info() + assert exc_tb is not None + fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] + print(exc_type, fname, exc_tb.tb_lineno) + tqdm.write( + f"[ERROR] PR #{pr.number} in {repo.full_name}. {exc_type} in {fname} at {exc_tb.tb_lineno}: {e}" + ) + tqdm.write(traceback.format_exc()) finally: pbar.update(1)