feat: add traceback printing for file read errors

This commit is contained in:
Paul Gauthier (aider) 2024-11-04 09:05:24 -08:00
parent 5e1be966ed
commit ebdc126b00

View file

@ -319,8 +319,9 @@ class InputOutput:
with open(str(filename), "r", encoding=self.encoding) as f:
return f.read()
except OSError as err:
import traceback
self.tool_error(f"{filename}: unable to read: {err}")
#ai print the trackback stack!
self.tool_error("Traceback:\n" + "".join(traceback.format_stack()))
return
except FileNotFoundError:
self.tool_error(f"{filename}: file not found error")