MCPcopy Create free account
hub / github.com/arctic-cli/interface / apiError

Function apiError

packages/arctic/test/session/retry.test.ts:5–21  ·  view source on GitHub ↗
(
  opts: {
    headers?: Record<string, string>
    message?: string
    statusCode?: number
    isRetryable?: boolean
    responseBody?: string
  } = {},
)

Source from the content-addressed store, hash-verified

3import { MessageV2 } from "../../src/session/message-v2"
4
5function apiError(
6 opts: {
7 headers?: Record<string, string>
8 message?: string
9 statusCode?: number
10 isRetryable?: boolean
11 responseBody?: string
12 } = {},
13): MessageV2.APIError {
14 return new MessageV2.APIError({
15 message: opts.message ?? "boom",
16 isRetryable: opts.isRetryable ?? true,
17 statusCode: opts.statusCode,
18 responseHeaders: opts.headers,
19 responseBody: opts.responseBody,
20 }).toObject() as MessageV2.APIError
21}
22
23describe("session.retry.delay", () => {
24 test("caps delay at 30 seconds when headers missing", () => {

Callers 1

retry.test.tsFile · 0.85

Calls 1

toObjectMethod · 0.80

Tested by

no test coverage detected