aws-samples / aws-samples/sample-spec-driven-presentation-maker

refactor: consolidate error handling between strandsParser and ChatPanel

Open
#121 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
128
Forks
10
Avg merge
4d 40m
Merged PRs (30d)
8

Description

## Background

PR #118 added agent-level error display to fix the infinite spinner issue.
The implementation works correctly but has some structural improvements to make.

## Tasks

- [ ] Extract error classification into a shared utility (e.g. `classifyAgentError(message)`)
- Returns error type: `conversation_limit` | `throttling` | `timeout` | `not_ready` | `service_unavailable` | `generic`
- Single source of truth for string matching logic
- [ ] Move UI display messages out of `strandsParser.js` into the UI layer
- Parser returns error type/code, ChatPanel decides display text
- [ ] Unify error display behavior: message replacement (not concatenation to `currentCompletion`)
- [ ] (Nice to have) Add `error_code` field to backend SSE error events to reduce reliance on string matching

## Context

- strandsParser.js: 5 error categories with emoji-prefixed messages
- ChatPanel.tsx: 3 categories (retryable / conversation-limit / generic)
- Current concatenation: `currentCompletion + errorMessage` may produce awkward output if partial response exists

## Related

- #118

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.