Add any to err on try catch

This commit is contained in:
Takeshi Kimata
2024-04-20 20:30:24 +09:00
parent 1f73da2c08
commit a1705d916e
13 changed files with 38 additions and 38 deletions

View File

@@ -20,7 +20,7 @@ export default function ProjectsPage() {
try {
const data = await fetchProjects();
setProjects(data);
} catch (error) {
} catch (error: any) {
console.error("Error in effect:", error.message);
}
}
@@ -70,7 +70,7 @@ export default function ProjectsPage() {
try {
await deleteProject(projectId);
setProjects(projects.filter((project) => project.id !== projectId));
} catch (error) {
} catch (error: any) {
console.error("Error deleting project:", error);
}
};

View File

@@ -89,7 +89,7 @@ export default function FoldersPane({ projectId }: Props) {
`/projects/${projectId}/folders/${smallestFolderId}/cases`
);
}
} catch (error) {
} catch (error: any) {
console.error("Error in effect:", error.message);
}
}

View File

@@ -15,7 +15,7 @@ export default function CasesPane({ projectId, folderId }: Props) {
try {
const data = await fetchCases(folderId);
setCases(data);
} catch (error) {
} catch (error: any) {
console.error("Error in effect:", error.message);
}
}

View File

@@ -153,7 +153,7 @@ export default function CaseEditor({
try {
const data = await fetchCase(params.caseId);
setTestCase(data);
} catch (error) {
} catch (error: any) {
console.error("Error in effect:", error.message);
}
}

View File

@@ -29,7 +29,7 @@ async function fetchDownloadAttachment(
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
} catch (error) {
} catch (error: any) {
console.error("Error downloading file:", error);
throw error;
}
@@ -54,7 +54,7 @@ async function fetchCreateAttachments(caseId: number, files: File[]) {
const responseData = await response.json();
return responseData;
} catch (error) {
} catch (error: any) {
console.error("Error uploading files:", error);
}
}
@@ -74,7 +74,7 @@ async function fetchDeleteAttachment(attachmentId: number) {
if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}
} catch (error) {
} catch (error: any) {
console.error("Error deleting file:", error);
throw error;
}

View File

@@ -17,7 +17,7 @@ async function fetchCreateStep(newStepNo: number, parentCaseId: number) {
throw new Error(`HTTP error! Status: ${response.status}`);
}
return await response.json();
} catch (error) {
} catch (error: any) {
console.error("Error deleting project:", error);
throw error;
}
@@ -38,7 +38,7 @@ async function fetchDeleteStep(stepId: number, parentCaseId: number) {
if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}
} catch (error) {
} catch (error: any) {
console.error("Error deleting project:", error);
throw error;
}

View File

@@ -19,7 +19,7 @@ async function fetchCase(caseId: number) {
const data = await response.json();
return data;
} catch (error) {
} catch (error: any) {
console.error("Error fetching data:", error.message);
}
}
@@ -41,7 +41,7 @@ async function fetchCases(folderId: string) {
const data = await response.json();
return data;
} catch (error) {
} catch (error: any) {
console.error("Error fetching data:", error.message);
}
}
@@ -77,7 +77,7 @@ async function createCase(folderId: string) {
}
const data = await response.json();
return data;
} catch (error) {
} catch (error: any) {
console.error("Error creating case:", error);
throw error;
}
@@ -101,7 +101,7 @@ async function updateCase(updateCaseData: CaseType) {
}
const data = await response.json();
return data;
} catch (error) {
} catch (error: any) {
console.error("Error updating project:", error);
throw error;
}
@@ -122,7 +122,7 @@ async function deleteCase(caseId: number) {
if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}
} catch (error) {
} catch (error: any) {
console.error("Error deleting case:", error);
throw error;
}
@@ -144,7 +144,7 @@ async function deleteCases(deleteCases: string[]) {
if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}
} catch (error) {
} catch (error: any) {
console.error("Error deleting cases:", error);
throw error;
}

View File

@@ -20,7 +20,7 @@ async function fetchFolders(projectId: string) {
const data = await response.json();
return data;
} catch (error) {
} catch (error: any) {
console.error("Error fetching data:", error.message);
}
}
@@ -58,7 +58,7 @@ async function createFolder(
}
const data = await response.json();
return data;
} catch (error) {
} catch (error: any) {
console.error("Error creating new project:", error);
throw error;
}
@@ -98,7 +98,7 @@ async function updateFolder(
}
const data = await response.json();
return data;
} catch (error) {
} catch (error: any) {
console.error("Error updating project:", error);
throw error;
}
@@ -122,7 +122,7 @@ async function deleteFolder(folderId: number) {
if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}
} catch (error) {
} catch (error: any) {
console.error("Error deleting project:", error);
throw error;
}

View File

@@ -18,7 +18,7 @@ async function fetchProject(url) {
const data = await response.json();
return data;
} catch (error) {
} catch (error: any) {
console.error("Error fetching data:", error.message);
}
}
@@ -39,7 +39,7 @@ export function Home({ projectId }: Props) {
const data = await fetchProject(url);
setProject(data);
console.log(data);
} catch (error) {
} catch (error: any) {
console.error("Error in effect:", error.message);
}
}

View File

@@ -17,7 +17,7 @@ export default function RunsPage({ projectId }: Props) {
try {
const data = await fetchRuns(projectId);
setRuns(data);
} catch (error) {
} catch (error: any) {
console.error("Error in effect:", error.message);
}
}
@@ -31,7 +31,7 @@ export default function RunsPage({ projectId }: Props) {
const updateRuns = [...runs];
updateRuns.push(newRun);
setRuns(updateRuns);
} catch (error) {
} catch (error: any) {
console.error("Error deleting run:", error);
}
};
@@ -41,7 +41,7 @@ export default function RunsPage({ projectId }: Props) {
await deleteRun(runId);
const data = await fetchRuns(projectId);
setRuns(data);
} catch (error) {
} catch (error: any) {
console.error("Error deleting run:", error);
}
};

View File

@@ -71,7 +71,7 @@ export default function RunEditor({ projectId, runId }: Props) {
setTestRun(runData);
const foldersData = await fetchFolders(projectId);
setFolders(foldersData);
} catch (error) {
} catch (error: any) {
console.error("Error in effect:", error.message);
}
}
@@ -101,7 +101,7 @@ export default function RunEditor({ projectId, runId }: Props) {
});
setTestCases(testCasesData);
} catch (error) {
} catch (error: any) {
console.error("Error fetching cases data:", error.message);
}
};

View File

@@ -19,7 +19,7 @@ async function fetchRun(runId: string) {
const data = await response.json();
return data;
} catch (error) {
} catch (error: any) {
console.error("Error fetching data:", error.message);
}
}
@@ -41,7 +41,7 @@ async function fetchRuns(projectId: string) {
const data = await response.json();
return data;
} catch (error) {
} catch (error: any) {
console.error("Error fetching data:", error.message);
}
}
@@ -72,7 +72,7 @@ async function createRun(projectId: string) {
}
const data = await response.json();
return data;
} catch (error) {
} catch (error: any) {
console.error("Error creating new test run:", error);
throw error;
}
@@ -96,7 +96,7 @@ async function updateRun(updateTestRun: RunType) {
}
const data = await response.json();
return data;
} catch (error) {
} catch (error: any) {
console.error("Error updating run:", error);
throw error;
}
@@ -117,7 +117,7 @@ async function deleteRun(runId: number) {
if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}
} catch (error) {
} catch (error: any) {
console.error("Error deleting run:", error);
throw error;
}
@@ -140,7 +140,7 @@ async function createRunCase(runId: string, caseId: number) {
}
const data = await response.json();
return data;
} catch (error) {
} catch (error: any) {
console.error("Error creating new runcase:", error);
throw error;
}
@@ -161,7 +161,7 @@ async function deleteRunCase(runId: string, caseId: number) {
if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}
} catch (error) {
} catch (error: any) {
console.error("Error deleting runcase:", error);
throw error;
}

View File

@@ -21,7 +21,7 @@ async function fetchProjects() {
const data = await response.json();
return data;
} catch (error) {
} catch (error: any) {
console.error("Error fetching data:", error.message);
}
}
@@ -52,7 +52,7 @@ async function createProject(name: string, detail: string) {
}
const data = await response.json();
return data;
} catch (error) {
} catch (error: any) {
console.error("Error creating new project:", error);
throw error;
}
@@ -84,7 +84,7 @@ async function updateProject(projectId: number, name: string, detail: string) {
}
const data = await response.json();
return data;
} catch (error) {
} catch (error: any) {
console.error("Error updating project:", error);
throw error;
}
@@ -108,7 +108,7 @@ async function deleteProject(projectId: number) {
if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}
} catch (error) {
} catch (error: any) {
console.error("Error deleting project:", error);
throw error;
}