Skip to content
This repository was archived by the owner on Apr 13, 2020. It is now read-only.

Commit 9dc82b7

Browse files
authored
[HOUSEKEEPING] have error identifiers for two errors in azure git lib (#528)
1 parent ca6f7e9 commit 9dc82b7

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

src/lib/git/azure.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -366,11 +366,10 @@ export const repositoryHasFile = async (
366366
);
367367

368368
if (gitItem === null) {
369-
throw Error(
370-
"Error installing build pipeline. Repository does not have a " +
371-
fileName +
372-
" file."
373-
);
369+
throw buildError(errorStatusCode.GIT_OPS_ERR, {
370+
errorKey: "git-azure-file-no-exist-in-repo",
371+
values: [fileName, branch, repoName],
372+
});
374373
}
375374
};
376375

@@ -393,9 +392,10 @@ export const validateRepository = async (
393392
const repo = await gitApi.getRepository(repoName, project);
394393

395394
if (!repo) {
396-
throw Error(
397-
`Project '${project}' does not contain repository '${repoName}'.`
398-
);
395+
throw buildError(errorStatusCode.GIT_OPS_ERR, {
396+
errorKey: "git-azure-repo-no-exist",
397+
values: [repoName, project],
398+
});
399399
}
400400

401401
await repositoryHasFile(fileName, branch, repoName, accessOpts);

src/lib/i18n.json

+2
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@
111111
"git-azure-get-match-branch-multiple": "Got more than one matching repositories in Azure DevOps with remote url '{0}' and branches '{1}' and '{2}'.",
112112
"git-azure-get-match-branch-err": "Could not get matching branch in Azure DevOps",
113113
"git-azure-create-pull-request-err": "Could not create pull request in Azure DevOps",
114+
"git-azure-repo-no-exist": "Repository {0} did not exist in project {1}.",
115+
"git-azure-file-no-exist-in-repo": "File {0} did not exist in {1} branch in repository {2}.",
114116

115117
"fileutils-append-variable-group-to-pipeline-yaml": "Could not append variable group name to manifest-generation.yaml file in HLD repo. Check this is file exist and if it is YAML format.",
116118
"fileutils-generate-hld-pipeline-yaml": "Could not generate HLD Azure pipeline YAML.",

0 commit comments

Comments
 (0)