Fixing getProjectId error message to be more descriptive

Signed-off-by: Joshua Jung <joshua.p.jung@gmail.com>
This commit is contained in:
Joshua Jung
2024-09-26 17:19:49 -05:00
parent 18369c1895
commit 920004b486
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 {