mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
feat(opencode): surface server startup and recovery failures in-app
This commit is contained in:
1 parent
53a70d8545
commit
7e9afc3da4
19 files changed
+454
-181
No files matched your search
@@ -6,6 +6,7 @@ export { FetchError }
|
||||
interface FetchWrapperOptions extends RequestInit {
|
||||
timeout?: number
|
||||
params?: Record<string, string | number | boolean | undefined>
|
||||
acceptedStatuses?: number[]
|
||||
}
|
||||
|
||||
function formatDetails(details: unknown): string | undefined {
|
||||
@@ -71,7 +72,7 @@ async function fetchWithTimeout(
|
||||
url: string,
|
||||
options: FetchWrapperOptions = {}
|
||||
): Promise<Response> {
|
||||
const { timeout = 30000, params, ...fetchOptions } = options
|
||||
const { timeout = 30000, params, acceptedStatuses, ...fetchOptions } = options
|
||||
const urlObj = buildUrl(url, params)
|
||||
|
||||
const controller = new AbortController()
|
||||
@@ -86,7 +87,7 @@ async function fetchWithTimeout(
|
||||
|
||||
if (timeoutId) clearTimeout(timeoutId)
|
||||
|
||||
if (!response.ok) {
|
||||
if (!response.ok && !acceptedStatuses?.includes(response.status)) {
|
||||
await handleResponse(response)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user