Skip to content

Commit 844551a

Browse files
Feat: Add error handling for project and folder creation responses
1 parent c165026 commit 844551a

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/tools/testmanagement-utils/create-project-folder.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,14 @@ export async function createProjectOrFolder(
6767
headers: { "Content-Type": "application/json" },
6868
},
6969
);
70+
71+
if (!res.data.data.success) {
72+
throw new Error(
73+
`Failed to create project: ${JSON.stringify(res.data)}`,
74+
);
75+
}
76+
// Project created successfully
77+
7078
projId = res.data.project.identifier;
7179
} catch (err) {
7280
const msg =
@@ -106,6 +114,14 @@ export async function createProjectOrFolder(
106114
headers: { "Content-Type": "application/json" },
107115
},
108116
);
117+
118+
if (!res.data.data.success) {
119+
throw new Error(
120+
`Failed to create folder: ${JSON.stringify(res.data)}`,
121+
);
122+
}
123+
// Folder created successfully
124+
109125
const folder = res.data.folder;
110126
return {
111127
content: [

0 commit comments

Comments
 (0)