Skip to content

fix(frontend): improve error code/message presentation and UX - #844

Open
tiantt wants to merge 1 commit into
mainfrom
fix/error-presentation-and-ux
Open

fix(frontend): improve error code/message presentation and UX#844
tiantt wants to merge 1 commit into
mainfrom
fix/error-presentation-and-ux

Conversation

@tiantt

@tiantt tiantt commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

改动内容

错误码与错误信息展示

src/adk/client.ts

  • AdkEvent 接口新增 errorCode/error_code 字段,ADK SSE 流里的错误码不再被丢弃
  • httpErrorMessage() 新增提取 errorCode/error_code/code 字段,有错误码时统一格式化为 [CODE] message
  • runSSE 迭代 SSE 帧时将 errorCode 前缀到 error/errorMessage/error_message
  • listAppswebSearchfetchAgentInfodeleteSessiongetStudioAccessgetStudioUpdateStatusgetSessioncancelAgentkitDeploymentdeleteRuntimegetMyRuntimeslistSessions 统一改用 httpErrorMessage(),不再裸扔 HTTP 状态码或原始文本
  • formatErrorDetail() 新增对象 .message 字段提取,避免将 JSON 字符串直接展示给用户;数组分支同时检查 msgmessage key

src/ui/DeploymentErrorMessage.tsx

  • <p>white-space: pre-wrap\n 分隔的多段提示(如会话丢失建议、工具参数提示)不再挤成一行

静默失败修复

src/create/CustomCreate.tsx

  • 3 处 catch 块在 error.message 为空字符串时会静默——改为 (error instanceof Error && error.message) ? error.message : String(error) || '未知错误',影响 openPublishPreviewhandleGenerateDraftstartDebugVariant
  • SSE 事件错误字段取值由 || 改为 ??,避免 falsy 值(如空字符串)被跳过

src/ui/MyAgents.tsx

  • useAgent() 新增 catch 块 + useError state,连接 Agent 失败不再静默

src/ui/AgentWorkspace.tsx

  • getRuntimeDetail 失败时新增 runtimeDetailError state,Basic 标签页不再永远显示"读取中…"
  • deleteCases()window.confirm() 替换为 StudioConfirmDialog,与同文件其他删除操作保持一致

无障碍访问(Accessibility)

src/ui/AgentWorkspace.tsx

  • agentsErrorfeedbackCasesError 错误容器加 role="alert"
  • updateCapabilityError 新增可见告警段落(之前只在 disabled 按钮 tooltip 里)

src/ui/SessionCapabilityDialogs.tsx

  • 拆分 spacesError / skillsError,space 加载失败不再让错误出现在 skills 面板
  • 动态错误 div 加 role="alert"
  • skill-space 加载失败新增重试按钮

表单校验与交互一致性

src/create/agentNameValidation.ts

  • 新增最大长度 64 字符校验
  • 校验失败时指出具体非法字符,不再仅重述规则

src/create/CustomCreate.tsx

  • name input 加 maxLength={64}

src/ui/ManageAgents.tsx

  • handleDeletewindow.confirm() 替换为 StudioConfirmDialog variant="danger"

src/ui/Navbar.tsx

  • Agent 切换 onAppChange 失败新增错误 state + role="alert" 提示;trigger 按钮加 aria-busy

🤖 Generated with Claude Code

…the board

- Expose ADK errorCode in SSE events and HTTP errors
- Fix silent failures and missing error feedback in multiple components
- Replace window.confirm with StudioConfirmDialog for destructive actions
- Add role=alert to dynamic error elements for accessibility

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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