diegosouzapw/OmniRoute · error · Error

await errorMessage(res)

Error message

await errorMessage(res)

What it means

Error "await errorMessage(res)" thrown in diegosouzapw/OmniRoute.

Source

Thrown at src/lib/inspector/tproxyCaptureApi.ts:25

 *   - DELETE → stop (close listener + uninstall CA + revert rules)
 *
 * Kept DOM-free so request/response/error handling is unit-testable by stubbing
 * global.fetch. The status type is imported type-only so this client bundle never
 * pulls the manager's native-addon / server dependencies.
 */
import type { CaptureManagerStatus } from "@/mitm/tproxy/captureManager";

const ROUTE = "/api/tools/agent-bridge/tproxy";

/** Extract the sanitized server error message, falling back to the status. */
async function errorMessage(res: Response): Promise<string> {
  const body = (await res.json().catch(() => null)) as { error?: { message?: string } } | null;
  return body?.error?.message ?? `HTTP ${res.status}`;
}

async function requestJson<T>(url: string, init?: RequestInit): Promise<T> {
  const res = await fetch(url, init);
  if (!res.ok) throw new Error(await errorMessage(res));
  return (await res.json()) as T;
}

/** Optional TPROXY config overrides + the sudo password (desktop, non-root only). */
export interface StartTproxyOptions {
  sudoPassword?: string;
  dport?: number;
  onPort?: number;
  mark?: number;
  routeTable?: number;
  bypassMark?: number;
}

/** Current decrypt-capture status (safe to poll). */
export function fetchTproxyStatus(): Promise<CaptureManagerStatus> {
  return requestJson<CaptureManagerStatus>(ROUTE);
}

View on GitHub (pinned to a179ffed5b)

When it happens

Trigger: Thrown at src/lib/inspector/tproxyCaptureApi.ts:25 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25). Data as JSON: /api/errors/30ddf61dc81d4fb1. Report an issue: GitHub.