{"record":{"id":"7a8db3539dffeabd","repo":"diegosouzapw/OmniRoute","slug":"errdata-error-message-http-res-status","errorCode":null,"errorMessage":"errData?.error?.message || `HTTP ${res.status}`","messagePattern":"errData\\?\\.error\\?\\.message \\|\\| `HTTP (.+?)`","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/app/(dashboard)/dashboard/providers/[id]/components/ProviderCcAliasSection.tsx","lineNumber":51,"sourceCode":"const DEFAULT_STATE: CcAliasState = { provider: null, models: {} };\n\nasync function fetchCcAliasState(providerId: string): Promise<CcAliasState> {\n  const res = await fetch(`/api/providers/${providerId}/cc-alias`);\n  const data = await res.json();\n  return {\n    provider: data?.provider === \"on\" || data?.provider === \"off\" ? data.provider : null,\n    models: data?.models && typeof data.models === \"object\" ? data.models : {},\n  };\n}\n\nasync function throwOnErrorResponse(res: Response): Promise<void> {\n  if (res.ok) return;\n  const errData = await res.json().catch(() => ({}));\n  const message =\n    typeof errData?.error === \"string\"\n      ? errData.error\n      : errData?.error?.message || `HTTP ${res.status}`;\n  throw new Error(message);\n}\n\nasync function putProviderSetting(providerId: string, value: CcAliasSettingValue): Promise<void> {\n  const res = await fetch(`/api/providers/${providerId}/cc-alias`, {\n    method: \"PUT\",\n    headers: { \"Content-Type\": \"application/json\" },\n    body: JSON.stringify({ scope: \"provider\", value }),\n  });\n  await throwOnErrorResponse(res);\n}\n\nasync function putModelSetting(\n  providerId: string,\n  modelId: string,\n  value: CcAliasSettingValue\n): Promise<void> {\n  const res = await fetch(`/api/providers/${providerId}/cc-alias`, {\n    method: \"PUT\",","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/app/(dashboard)/dashboard/providers/[id]/components/ProviderCcAliasSection.tsx#L33-L69","documentation":"Generic guard in throwOnErrorResponse: thrown when a cc-alias API call (GET state or its mutations) responds non-OK. The sentinel `HTTP ${res.status}` fires when the error body cannot be parsed or lacks error.message — the concrete cause is the status code itself.","triggerScenarios":"Thrown at src/app/(dashboard)/dashboard/providers/[id]/components/ProviderCcAliasSection.tsx:51 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reload the provider detail page to refetch cc-alias state","Check /api/providers/[id]/cc-alias logs for the failing handler","Confirm the provider id/alias in the URL resolves to a real connection"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}