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

Function failWith

packages/llm/test/executor.test.ts:270–291  ·  view source on GitHub ↗
(status: number)

Source from the content-addressed store, hash-verified

268 it.effect("marks 504 and 529 status responses retryable", () =>
269 Effect.gen(function* () {
270 const failWith = (status: number) =>
271 Effect.gen(function* () {
272 const executor = yield* RequestExecutor.Service
273 const error = yield* executor.execute(request).pipe(Effect.flip)
274
275 expectLLMError(error)
276 expect(error.reason).toMatchObject({ _tag: "ProviderInternal", status })
277 expect(error.retryable).toBe(true)
278 }).pipe(
279 Effect.provide(
280 responsesLayer(
281 Array.from(
282 { length: 3 },
283 () =>
284 new Response("retry", {
285 status,
286 headers: { "retry-after-ms": "0" },
287 }),
288 ),
289 ),
290 ),
291 )
292
293 yield* failWith(504)
294 yield* failWith(529)

Callers 1

executor.test.tsFile · 0.85

Calls 4

expectLLMErrorFunction · 0.85
responsesLayerFunction · 0.85
executeMethod · 0.65
fromMethod · 0.45

Tested by

no test coverage detected