agent-ecosystem/src/shared/utils/apiErrorDetector.ts
iliya 08f22121c6 feat: enhance error handling and notifications for API errors
- Implemented a new mechanism to detect and notify users of API errors within team communications, improving error visibility.
- Updated the ActivityItem and ThoughtBodyContent components to visually indicate API errors with distinct styling.
- Enhanced the TaskDetailDialog and KanbanTaskCard components to improve user experience by providing clearer feedback on task dependencies and statuses.
- Refactored the teams IPC module to include checks for API errors, ensuring timely notifications are sent to users.
2026-03-19 12:47:00 +02:00

13 lines
356 B
TypeScript

/**
* Detects API error messages from Claude CLI output.
* Pattern: "API Error: <status_code>" at the beginning of the text.
*/
const API_ERROR_RE = /^API Error:\s*\d{3}/;
/**
* Returns true if the message text starts with "API Error: <status_code>".
*/
export function isApiErrorMessage(text: string): boolean {
return API_ERROR_RE.test(text);
}