mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 12:24:30 +01:00
feat(worktree): worktree tabs, server env vars, and multi-directory SSE (#240)
* loop: worktree-tabs-2 completed after 4 iterations * loop: server-env-vars completed after 7 iterations * feat(worktree): add worktree tabs and server env vars settings * refactor(worktree): multi-directory SSE support and workspace chip row * feat(workspace): collapsible workspace manager and sibling filtering * feat(workspace): workspace creation endpoint, refactored workspace manager, and tests * refactor(frontend): unify workspace label and remove dead code - extract shared workspaceLabel helper into api/repos and reuse in WorkspaceManager and RepoDetail directoryLabels - remove unused useSessions hook and subscribeToDirectory subscription - drop redundant frontend workspace dedup now guaranteed by backend - align WorktreeTabs empty-state test with create-workspace button
This commit is contained in:
1 parent
60ed756a0b
commit
b9236f7f20
38 files changed
+2423
-133
No files matched your search
@@ -29,10 +29,22 @@ function formatDetails(details: unknown): string | undefined {
|
||||
}
|
||||
|
||||
async function handleResponse(response: Response): Promise<never> {
|
||||
const data: ApiErrorResponse = await response.json().catch(() => ({ error: 'An error occurred' }))
|
||||
const text = await response.text().catch(() => '')
|
||||
const data: ApiErrorResponse = (() => {
|
||||
if (!text) return { error: 'An error occurred' }
|
||||
try {
|
||||
return JSON.parse(text) as ApiErrorResponse
|
||||
} catch {
|
||||
return { error: text }
|
||||
}
|
||||
})()
|
||||
const errorData = data as ApiErrorResponse & { message?: string; data?: { message?: unknown } }
|
||||
const openCodeMessage = typeof errorData.data?.message === 'string'
|
||||
? errorData.data.message
|
||||
: undefined
|
||||
const detail = data.detail || formatDetails(data.details)
|
||||
throw new FetchError(
|
||||
data.error || 'Request failed',
|
||||
data.error || errorData.message || openCodeMessage || 'Request failed',
|
||||
response.status,
|
||||
data.code,
|
||||
detail,
|
||||
|
||||
Reference in new issue
Block a user