mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 01:35:00 +00:00
Handle multiline tool_error() better
This commit is contained in:
parent
ebeec04cae
commit
edc70bdf84
2 changed files with 12 additions and 10 deletions
|
@ -1102,14 +1102,12 @@ class Coder:
|
|||
if self.apply_update_errors < self.max_apply_update_errors:
|
||||
self.io.tool_error(f"Malformed response #{self.apply_update_errors}, retrying...")
|
||||
self.io.tool_error("https://aider.chat/docs/faq.html#aider-isnt-editing-my-files")
|
||||
for line in str(err).splitlines():
|
||||
self.io.tool_error(line, strip=False)
|
||||
self.io.tool_error(str(err), strip=False)
|
||||
return None, err
|
||||
else:
|
||||
self.io.tool_error(f"Malformed response #{self.apply_update_errors}, aborting.")
|
||||
self.io.tool_error("https://aider.chat/docs/faq.html#aider-isnt-editing-my-files")
|
||||
for line in str(err).splitlines():
|
||||
self.io.tool_error(line, strip=False)
|
||||
self.io.tool_error(str(err), strip=False)
|
||||
return False, None
|
||||
|
||||
except git.exc.GitCommandError as err:
|
||||
|
@ -1122,11 +1120,11 @@ class Coder:
|
|||
self.apply_update_errors += 1
|
||||
if self.apply_update_errors < self.max_apply_update_errors:
|
||||
self.io.tool_error(f"Update exception #{self.apply_update_errors}, retrying...")
|
||||
self.io.tool_error(str(err))
|
||||
self.io.tool_error(str(err), strip=False)
|
||||
return None, str(err)
|
||||
else:
|
||||
self.io.tool_error(f"Update exception #{self.apply_update_errors}, aborting")
|
||||
self.io.tool_error(str(err))
|
||||
self.io.tool_error(str(err), strip=False)
|
||||
return False, None
|
||||
|
||||
self.apply_update_errors = 0
|
||||
|
|
12
aider/io.py
12
aider/io.py
|
@ -329,11 +329,15 @@ class InputOutput:
|
|||
self.num_error_outputs += 1
|
||||
|
||||
if message.strip():
|
||||
if strip:
|
||||
hist = message.strip()
|
||||
if "\n" in message:
|
||||
for line in message.splitlines():
|
||||
self.append_chat_history(line, linebreak=True, blockquote=True)
|
||||
else:
|
||||
hist = message
|
||||
self.append_chat_history(hist, linebreak=True, blockquote=True)
|
||||
if strip:
|
||||
hist = message.strip()
|
||||
else:
|
||||
hist = message
|
||||
self.append_chat_history(hist, linebreak=True, blockquote=True)
|
||||
|
||||
message = Text(message)
|
||||
style = dict(style=self.tool_error_color) if self.tool_error_color else dict()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue