integration: forward errors from gitlab project lookups

This commit is contained in:
Patrik Oldsberg
2021-01-28 18:06:47 +01:00
parent 8b57797896
commit 605629dc74
+8 -3
View File
@@ -147,10 +147,15 @@ export async function getProjectId(
repoIDLookup.toString(),
getGitLabRequestOptions(config),
);
const projectIDJson = await response.json();
const projectID = Number(projectIDJson.id);
const data = await response.json();
return projectID;
if (!response.ok) {
throw new Error(
`GitLab Error '${data.error}', ${data.error_description}`,
);
}
return Number(data.id);
} catch (e) {
throw new Error(`Could not get GitLab project ID for: ${target}, ${e}`);
}