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

[HOUSEKEEPING] have error identifiers for two errors in azure git lib #528

Merged
merged 3 commits into from
Apr 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/lib/git/azure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,11 +366,10 @@ export const repositoryHasFile = async (
);

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

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

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

await repositoryHasFile(fileName, branch, repoName, accessOpts);
Expand Down
2 changes: 2 additions & 0 deletions src/lib/i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@
"git-azure-get-match-branch-multiple": "Got more than one matching repositories in Azure DevOps with remote url '{0}' and branches '{1}' and '{2}'.",
"git-azure-get-match-branch-err": "Could not get matching branch in Azure DevOps",
"git-azure-create-pull-request-err": "Could not create pull request in Azure DevOps",
"git-azure-repo-no-exist": "Repository {0} did not exist in project {1}.",
"git-azure-file-no-exist-in-repo": "File {0} did not exist in {1} branch in repository {2}.",

"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.",
"fileutils-generate-hld-pipeline-yaml": "Could not generate HLD Azure pipeline YAML.",
Expand Down