{"record":{"id":"30ddf61dc81d4fb1","repo":"diegosouzapw/OmniRoute","slug":"await-errormessage-res-30ddf6","errorCode":null,"errorMessage":"await errorMessage(res)","messagePattern":"await errorMessage\\(res\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/lib/inspector/tproxyCaptureApi.ts","lineNumber":25,"sourceCode":" *   - DELETE → stop (close listener + uninstall CA + revert rules)\n *\n * Kept DOM-free so request/response/error handling is unit-testable by stubbing\n * global.fetch. The status type is imported type-only so this client bundle never\n * pulls the manager's native-addon / server dependencies.\n */\nimport type { CaptureManagerStatus } from \"@/mitm/tproxy/captureManager\";\n\nconst ROUTE = \"/api/tools/agent-bridge/tproxy\";\n\n/** Extract the sanitized server error message, falling back to the status. */\nasync function errorMessage(res: Response): Promise<string> {\n  const body = (await res.json().catch(() => null)) as { error?: { message?: string } } | null;\n  return body?.error?.message ?? `HTTP ${res.status}`;\n}\n\nasync function requestJson<T>(url: string, init?: RequestInit): Promise<T> {\n  const res = await fetch(url, init);\n  if (!res.ok) throw new Error(await errorMessage(res));\n  return (await res.json()) as T;\n}\n\n/** Optional TPROXY config overrides + the sudo password (desktop, non-root only). */\nexport interface StartTproxyOptions {\n  sudoPassword?: string;\n  dport?: number;\n  onPort?: number;\n  mark?: number;\n  routeTable?: number;\n  bypassMark?: number;\n}\n\n/** Current decrypt-capture status (safe to poll). */\nexport function fetchTproxyStatus(): Promise<CaptureManagerStatus> {\n  return requestJson<CaptureManagerStatus>(ROUTE);\n}\n","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/inspector/tproxyCaptureApi.ts#L7-L43","documentation":"Error \"await errorMessage(res)\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/lib/inspector/tproxyCaptureApi.ts:25 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","schemaVersion":2},"datasetVersion":"2026-08-25T21:54:21.419Z"}