diegosouzapw/OmniRoute · error · Error
errData.error || `HTTP
Error message
errData.error || `HTTP ${res.status}` What it means
Generic guard thrown when an interception-rules API call returns non-OK. `HTTP ${res.status}` is the fallback when errData.error is absent — meaning the server responded with an error code but no structured error body (auth rejection, bad provider id, handler crash).
Solutions
- Reload the section to refetch interception toggles
- Verify the provider id resolves; 404 means unknown provider
- Check server logs for the interception-rules handler failure
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at src/app/(dashboard)/dashboard/providers/[id]/components/ProviderInterceptionSection.tsx:47 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/200aa90d9357a6b8.
Report an issue: GitHub.
Appendix: source
Thrown at src/app/(dashboard)/dashboard/providers/[id]/components/ProviderInterceptionSection.tsx:47
}
type Translate = (key: string, values?: Record<string, string>) => string;
const DEFAULT_TOGGLES: InterceptionToggles = { interceptSearch: false, interceptFetch: false };
async function fetchInterceptionToggles(providerId: string): Promise<InterceptionToggles> {
const res = await fetch(`/api/providers/${providerId}/interception-rules`);
const data = await res.json();
return {
interceptSearch: data?.interceptSearch === true,
interceptFetch: data?.interceptFetch === true,
};
}
async function throwOnErrorResponse(res: Response): Promise<void> {
if (res.ok) return;
const errData = await res.json().catch(() => ({}));
throw new Error(errData.error || `HTTP ${res.status}`);
}
async function putInterceptionToggles(
providerId: string,
toggles: InterceptionToggles
): Promise<void> {
const res = await fetch(`/api/providers/${providerId}/interception-rules`, {
method: "PUT",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(toggles),
});
await throwOnErrorResponse(res);
}
function errorMessage(err: unknown): string {
return err instanceof Error ? err.message : String(err);
}
View on GitHub (pinned to a179ffed5b)