Skip to content
Snippets Groups Projects
Commit bcaabf5c authored by Rhys Arkins's avatar Rhys Arkins
Browse files

chore: log branchName with git errors

parent 3f195448
No related branches found
No related tags found
No related merge requests found
......@@ -169,7 +169,9 @@ export class Storage {
// Return the commit SHA for a branch
async getBranchCommit(branchName: string) {
if (!(await this.branchExists(branchName))) {
throw Error('Cannot fetch commit for branch that does not exist');
throw Error(
'Cannot fetch commit for branch that does not exist: ' + branchName
);
}
const res = await this._git!.revparse(['origin/' + branchName]);
return res.trim();
......@@ -188,7 +190,8 @@ export class Storage {
if (branchName) {
if (!(await this.branchExists(branchName))) {
throw new Error(
'Cannot set baseBranch to something that does not exist'
'Cannot set baseBranch to something that does not exist: ' +
branchName
);
}
logger.debug(`Setting baseBranch to ${branchName}`);
......@@ -293,7 +296,9 @@ export class Storage {
async isBranchStale(branchName: string) {
if (!(await this.branchExists(branchName))) {
throw Error('Cannot check staleness for branch that does not exist');
throw Error(
'Cannot check staleness for branch that does not exist: ' + branchName
);
}
const branches = await this._git!.branch([
'--remotes',
......
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`platform/git/storage getBranchCommit(branchName) should throw if branch does not exist 1`] = `[Error: Cannot fetch commit for branch that does not exist]`;
exports[`platform/git/storage getBranchCommit(branchName) should throw if branch does not exist 1`] = `[Error: Cannot fetch commit for branch that does not exist: not_found]`;
exports[`platform/git/storage getCommitMessages() returns commit messages 1`] = `
Array [
......@@ -42,6 +42,6 @@ Array [
]
`;
exports[`platform/git/storage isBranchStale() should throw if branch does not exist 1`] = `[Error: Cannot check staleness for branch that does not exist]`;
exports[`platform/git/storage isBranchStale() should throw if branch does not exist 1`] = `[Error: Cannot check staleness for branch that does not exist: not_found]`;
exports[`platform/git/storage setBaseBranch(branchName) should throw if branch does not exist 1`] = `[Error: Cannot set baseBranch to something that does not exist]`;
exports[`platform/git/storage setBaseBranch(branchName) should throw if branch does not exist 1`] = `[Error: Cannot set baseBranch to something that does not exist: not_found]`;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment