Merge pull request #26865 from joshjung/jjung/fix-error-message-getprojectid

Fix error message for getProjectId (GitLab)
This commit is contained in:
Ben Lambert
2024-10-01 11:15:17 +02:00
committed by GitHub
3 changed files with 12 additions and 2 deletions
+6
View File
@@ -0,0 +1,6 @@
---
'@backstage/backend-defaults': patch
'@backstage/integration': patch
---
Updating error message for getProjectId when fetching Gitlab project from its url to be more accurate
@@ -697,7 +697,9 @@ describe('GitlabUrlReader', () => {
(gitlabProcessor as any).getGitlabFetchUrl(
'https://gitlab.com/some/random/endpoint',
),
).rejects.toThrow('Please provide full path to yaml file from GitLab');
).rejects.toThrow(
'Failed converting /some/random/endpoint to a project id. Url path must include /blob/.',
);
});
});
+3 -1
View File
@@ -116,7 +116,9 @@ export async function getProjectId(
const url = new URL(target);
if (!url.pathname.includes('/blob/')) {
throw new Error('Please provide full path to yaml file from GitLab');
throw new Error(
`Failed converting ${url.pathname} to a project id. Url path must include /blob/.`,
);
}
try {