Skip to content

fix: improve chat error handling and display user-friendly context limit message#486

Open
Salman-Ahamed wants to merge 1 commit intodevfrom
fix/chat-error-handling-and-context-limit
Open

fix: improve chat error handling and display user-friendly context limit message#486
Salman-Ahamed wants to merge 1 commit intodevfrom
fix/chat-error-handling-and-context-limit

Conversation

@Salman-Ahamed
Copy link
Contributor

@Salman-Ahamed Salman-Ahamed commented Feb 25, 2026

🎯 What’s this PR about?

  • Fix plain TChatError objects being swallowed by handleStreamError, resulting in generic "An unexpected error occurred" instead of actual error messages
  • Display user-friendly message when context limit is exceeded
  • Add isRetryable flag to error/message types to control retry button visibility from the source (handleStreamError) instead of fragile string matching in UI
  • Clean up LOADING and META messages on stream error (was only cleaning LOADING)

📎 Related ClickUp Ticket

https://app.clickup.com/t/86ewmup53


💻 Demo (optional)


✅ Checklist

  • Self-reviewed the code
  • Linked the correct ClickUp ticket
  • Tested locally (MANDATORY)
  • Marked as Draft if not ready for review

- Updated `handleStreamError` to include `isRetryable` property for better error management.
- Modified `Error` component to conditionally render retry button based on `isRetryable` prop.
- Adjusted `useChatState` to filter out META messages and include `isRetryable` in error messages.
- Added `isRetryable` property to `TChatMessage` and `TChatError` types for consistency across error handling.
Copy link
Contributor Author

@Salman-Ahamed Salman-Ahamed left a comment

Choose a reason for hiding this comment

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

reviewed

@Salman-Ahamed Salman-Ahamed self-assigned this Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant