mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 10:14:59 +00:00
fix: Handle different OSError types in write_text method
This commit is contained in:
parent
c725c45726
commit
f7de2234f2
1 changed files with 4 additions and 1 deletions
|
@ -351,13 +351,16 @@ class InputOutput:
|
|||
with open(str(filename), "w", encoding=self.encoding) as f:
|
||||
f.write(content)
|
||||
return # Successfully wrote the file
|
||||
except OSError as err:
|
||||
except PermissionError as err:
|
||||
if attempt < max_retries - 1:
|
||||
time.sleep(delay)
|
||||
delay *= 2 # Exponential backoff
|
||||
else:
|
||||
self.tool_error(f"Unable to write file {filename} after {max_retries} attempts: {err}")
|
||||
raise
|
||||
except OSError as err:
|
||||
self.tool_error(f"Unable to write file {filename}: {err}")
|
||||
raise
|
||||
|
||||
def rule(self):
|
||||
if self.pretty:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue