mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 09:44:59 +00:00
fix: improve exception handling to show correct filename and line number
This commit is contained in:
parent
c458489cc0
commit
4a26bc6c70
1 changed files with 7 additions and 1 deletions
|
@ -55,8 +55,14 @@ def exception_handler(exc_type, exc_value, exc_traceback):
|
|||
tb_lines = traceback.format_exception(exc_type, exc_value, exc_traceback)
|
||||
tb_text = "".join(tb_lines)
|
||||
|
||||
# Find the first non-frozen frame
|
||||
while exc_traceback:
|
||||
filename = exc_traceback.tb_frame.f_code.co_filename
|
||||
if not filename.startswith('<frozen '):
|
||||
break
|
||||
exc_traceback = exc_traceback.tb_next
|
||||
|
||||
# Get the filename and line number
|
||||
filename = exc_traceback.tb_frame.f_code.co_filename
|
||||
line_number = exc_traceback.tb_lineno
|
||||
basename = os.path.basename(filename)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue