mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-03 03:05:00 +00:00
feat: add error handling for file writing in InputOutput class
This commit is contained in:
parent
b3928dabbc
commit
b3ce70234e
1 changed files with 5 additions and 2 deletions
|
@ -259,8 +259,11 @@ class InputOutput:
|
||||||
def write_text(self, filename, content):
|
def write_text(self, filename, content):
|
||||||
if self.dry_run:
|
if self.dry_run:
|
||||||
return
|
return
|
||||||
with open(str(filename), "w", encoding=self.encoding) as f:
|
try:
|
||||||
f.write(content)
|
with open(str(filename), "w", encoding=self.encoding) as f:
|
||||||
|
f.write(content)
|
||||||
|
except OSError as err:
|
||||||
|
self.tool_error(f"Unable to write file {filename}: {err}")
|
||||||
|
|
||||||
def rule(self):
|
def rule(self):
|
||||||
if self.pretty:
|
if self.pretty:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue