mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 17:55:01 +00:00
fix: use innermost traceback frame for error reporting
This commit is contained in:
parent
96adf93cec
commit
725da4ba9f
1 changed files with 8 additions and 12 deletions
|
@ -77,19 +77,15 @@ def exception_handler(exc_type, exc_value, exc_traceback):
|
||||||
|
|
||||||
tb_text = "".join(tb_lines_with_basenames)
|
tb_text = "".join(tb_lines_with_basenames)
|
||||||
|
|
||||||
# Find the first non-frozen frame
|
# Find the innermost frame
|
||||||
while exc_traceback:
|
innermost_tb = exc_traceback
|
||||||
filename = exc_traceback.tb_frame.f_code.co_filename
|
while innermost_tb.tb_next:
|
||||||
if not filename.startswith("<frozen "):
|
innermost_tb = innermost_tb.tb_next
|
||||||
break
|
|
||||||
exc_traceback = exc_traceback.tb_next
|
|
||||||
|
|
||||||
# Get the filename and line number
|
# Get the filename and line number from the innermost frame
|
||||||
line_number = exc_traceback.tb_lineno
|
filename = innermost_tb.tb_frame.f_code.co_filename
|
||||||
try:
|
line_number = innermost_tb.tb_lineno
|
||||||
basename = os.path.basename(filename)
|
basename = os.path.basename(filename)
|
||||||
except Exception:
|
|
||||||
basename = filename
|
|
||||||
|
|
||||||
# Get the exception type name
|
# Get the exception type name
|
||||||
exception_type = exc_type.__name__
|
exception_type = exc_type.__name__
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue