mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 09:14:59 +00:00
refactor: replace full file paths with basenames in exception traceback
This commit is contained in:
parent
29cf1e322e
commit
1cc2b2ef63
1 changed files with 13 additions and 1 deletions
|
@ -57,7 +57,19 @@ def exception_handler(exc_type, exc_value, exc_traceback):
|
|||
|
||||
# Format the traceback
|
||||
tb_lines = traceback.format_exception(exc_type, exc_value, exc_traceback)
|
||||
tb_text = "".join(tb_lines)
|
||||
|
||||
# Replace full paths with basenames in the traceback
|
||||
tb_lines_with_basenames = []
|
||||
for line in tb_lines:
|
||||
if "File " in line:
|
||||
parts = line.split('"')
|
||||
if len(parts) > 1:
|
||||
full_path = parts[1]
|
||||
basename = os.path.basename(full_path)
|
||||
line = line.replace(full_path, basename)
|
||||
tb_lines_with_basenames.append(line)
|
||||
|
||||
tb_text = "".join(tb_lines_with_basenames)
|
||||
|
||||
# Find the first non-frozen frame
|
||||
while exc_traceback:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue