Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/goose/cli/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from pathlib import Path
from typing import Any, Dict, List, Optional

from exchange import Message, ToolResult, ToolUse, Text
from exchange import Message, ToolResult, ToolUse, Text, FailedToGenerateMessageError
from prompt_toolkit.shortcuts import confirm
from rich import print
from rich.console import RenderableType
Expand Down Expand Up @@ -156,10 +156,10 @@ def run(self) -> None:
self.reply() # Process the user message.
except KeyboardInterrupt:
self.interrupt_reply()
except Exception:
except FailedToGenerateMessageError:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a related message in the other PR, I think a more generic exception catch does make sense here
square/exchange#30 (comment)

# rewind to right before the last user message
self.exchange.rewind_to_last_user_message()
print(traceback.format_exc())
if self.exchange.messages:
self.exchange.messages.pop()
print(
"\n[red]The error above was an exception we were not able to handle.\n\n[/]"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe update this print statement to say a bit more clear about clearing the state to the just before the previous user prompt?

+ "These errors are often related to connection or authentication\n"
Expand Down