mirror of
https://github.com/JohnRiceML/clawport-ui.git
synced 2026-08-14 08:51:58 +00:00
- Fix XSS in memory browser (escape-first markdown pipeline) - Add API input validation with discriminated union returns - Fix chat race condition with useRef for message freshness - Wire up agent search filtering in chat sidebar - Remove debug logging, add proper error responses to all API routes - Fix NavLinks silent error swallowing - Handle overdue cron timestamps - Extract agent registry to JSON config - Remove unused @anthropic-ai/sdk dependency - Set up Vitest with 68 tests (conversations, agents, crons) - Add skeleton loaders, ErrorState component, keyboard navigation - Add responsive mobile sidebar with hamburger menu - Add ARIA labels, roles, prefers-reduced-motion support - Fix broken CSS vars in agent detail page - Replace hardcoded colors with theme variables - Define typography scale (--text-xs through --text-4xl) - Move inline hover styles to CSS classes - Polish light theme shadows and accent contrast - Add shimmer/slideDown animations, code block copy button Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
17 lines
498 B
TypeScript
17 lines
498 B
TypeScript
/**
|
|
* Shared error response helper for API routes.
|
|
* Returns a consistent JSON shape: { error: string }
|
|
* so clients can distinguish "no data" from "server error".
|
|
*/
|
|
export function apiErrorResponse(
|
|
err: unknown,
|
|
fallbackMessage = 'Internal server error',
|
|
status = 500
|
|
): Response {
|
|
const message = err instanceof Error ? err.message : fallbackMessage
|
|
return new Response(JSON.stringify({ error: message }), {
|
|
status,
|
|
headers: { 'Content-Type': 'application/json' },
|
|
})
|
|
}
|