MCPcopy
hub / github.com/anomalyco/opencode / tryFetch

Function tryFetch

packages/opencode/src/cli/cmd/import.ts:121–128  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

119 const headers = shouldAttachShareAuthHeaders(file, req.baseUrl) ? req.headers : {}
120
121 const tryFetch = (url: string) =>
122 Effect.tryPromise({
123 try: () => fetch(url, { headers }),
124 catch: (e) =>
125 new CliError({
126 message: `Failed to fetch share data: ${e instanceof Error ? e.message : String(e)}`,
127 }),
128 })
129
130 const dataPath = req.api.data(slug)
131 let response = yield* tryFetch(`${baseUrl}${dataPath}`)

Callers 1

import.tsFile · 0.85

Calls 1

fetchFunction · 0.50

Tested by

no test coverage detected