INNER CODE UNIT · TypeScript

errorCode

JuliusBrussee/caveman · packages/device-auth/src/index.ts:57

function errorCode(body: unknown): string | undefined {
  const error = (body as { error?: unknown } | null)?.error;
  if (typeof error === "string") return error;
  const code = (error as { code?: unknown } | null | undefined)?.code;
  return typeof code === "string" ? code : undefined;
}

function requestSignal(signal: AbortSignal | undefined, timeoutMs: number): AbortSignal {
  const timeout = AbortSignal.timeout(timeoutMs);
  return signal === undefined ? timeout : AbortSignal.any([signal, timeout]);
}

async function acknowledge(
  options: {
    baseURL: string;
    client: string;
    code: DeviceCode;
    credentials: DeviceCredentials;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…