Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const fetchAccessGroupDetails = async (
if (!response.ok) {
const errorData = await response.json();
const errorMessage = deriveErrorMessage(errorData);
handleError(errorMessage);
handleError(errorData);
throw new Error(errorMessage);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,10 @@ describe("useAccessGroups", () => {
expect(result.current.error).toBeInstanceOf(Error);
expect((result.current.error as Error).message).toBe("Forbidden");
expect(result.current.data).toBeUndefined();
expect(networking.handleError).toHaveBeenCalledWith("Forbidden");
// handleError now receives the raw error object (not the derived string)
// so its built-in `extractErrorType` can dispatch on `error.type` for
// auth-related redirects (D1 taxonomy). See networking.tsx:507.
expect(networking.handleError).toHaveBeenCalledWith({ detail: "Forbidden" });
});

it("should return empty array when API returns empty list", async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const fetchAccessGroups = async (
if (!response.ok) {
const errorData = await response.json();
const errorMessage = deriveErrorMessage(errorData);
handleError(errorMessage);
handleError(errorData);
throw new Error(errorMessage);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const createAccessGroup = async (
if (!response.ok) {
const errorData = await response.json();
const errorMessage = deriveErrorMessage(errorData);
handleError(errorMessage);
handleError(errorData);
throw new Error(errorMessage);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const deleteAccessGroup = async (
if (!response.ok) {
const errorData = await response.json();
const errorMessage = deriveErrorMessage(errorData);
handleError(errorMessage);
handleError(errorData);
throw new Error(errorMessage);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const updateAccessGroup = async (
if (!response.ok) {
const errorData = await response.json();
const errorMessage = deriveErrorMessage(errorData);
handleError(errorMessage);
handleError(errorData);
throw new Error(errorMessage);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const registerGuardrail = async (
if (!response.ok) {
const errorData = await response.json().catch(() => ({}));
const errorMessage = deriveErrorMessage(errorData);
handleError(errorMessage);
handleError(errorData);
throw new Error(errorMessage);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const keyListCall = async (
if (!response.ok) {
const errorData = await response.json();
const errorMessage = deriveErrorMessage(errorData);
handleError(errorMessage);
handleError(errorData);
throw new Error(errorMessage);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const resetKeySpend = async (
if (!response.ok) {
const errorData = await response.json();
const errorMessage = deriveErrorMessage(errorData);
handleError(errorMessage);
handleError(errorData);
throw new Error(errorMessage);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const createProject = async (
if (!response.ok) {
const errorData = await response.json();
const errorMessage = deriveErrorMessage(errorData);
handleError(errorMessage);
handleError(errorData);
throw new Error(errorMessage);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const deleteProjects = async (
if (!response.ok) {
const errorData = await response.json();
const errorMessage = deriveErrorMessage(errorData);
handleError(errorMessage);
handleError(errorData);
throw new Error(errorMessage);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const fetchProjectDetails = async (
if (!response.ok) {
const errorData = await response.json();
const errorMessage = deriveErrorMessage(errorData);
handleError(errorMessage);
handleError(errorData);
throw new Error(errorMessage);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const fetchProjects = async (
if (!response.ok) {
const errorData = await response.json();
const errorMessage = deriveErrorMessage(errorData);
handleError(errorMessage);
handleError(errorData);
throw new Error(errorMessage);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const updateProject = async (
if (!response.ok) {
const errorData = await response.json();
const errorMessage = deriveErrorMessage(errorData);
handleError(errorMessage);
handleError(errorData);
throw new Error(errorMessage);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export const getProxyConfigCall = async (accessToken: string, configType: Config
if (!response.ok) {
const errorData = await response.json();
const errorMessage = deriveErrorMessage(errorData);
handleError(errorMessage);
handleError(errorData);
throw new Error(errorMessage);
}

Expand Down Expand Up @@ -128,7 +128,7 @@ export const deleteProxyConfigFieldCall = async (
if (!response.ok) {
const errorData = await response.json();
const errorMessage = deriveErrorMessage(errorData);
handleError(errorMessage);
handleError(errorData);
throw new Error(errorMessage);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const teamListCall = async (
if (!response.ok) {
const errorData = await response.json();
const errorMessage = deriveErrorMessage(errorData);
handleError(errorMessage);
handleError(errorData);
throw new Error(errorMessage);
}

Expand Down Expand Up @@ -202,7 +202,7 @@ const deletedTeamListCall = async (
if (!response.ok) {
const errorData = await response.json();
const errorMessage = deriveErrorMessage(errorData);
handleError(errorMessage);
handleError(errorData);
throw new Error(errorMessage);
}

Expand Down
Loading