diff --git a/lib/platform/git/storage.ts b/lib/platform/git/storage.ts index 50ae414d900b13a538f9e224d0c16438bf6eb632..cd53c9d9abb35027af6fd880039843c06fde8a02 100644 --- a/lib/platform/git/storage.ts +++ b/lib/platform/git/storage.ts @@ -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', diff --git a/test/platform/git/__snapshots__/storage.spec.ts.snap b/test/platform/git/__snapshots__/storage.spec.ts.snap index 0017cdca097ce96a730db4c217645225aa8101b5..1f6cdc925e36c40d48acfe5b286d8b0d165bb7e8 100644 --- a/test/platform/git/__snapshots__/storage.spec.ts.snap +++ b/test/platform/git/__snapshots__/storage.spec.ts.snap @@ -1,6 +1,6 @@ // 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]`;