diff --git a/lib/platform/bitbucket-server/index.ts b/lib/platform/bitbucket-server/index.ts index 410d12fcf4028f92e92c69707d8ba7c53a67e915..e70cfb24fb831fe4ec221c11d94631f5151dbbfc 100644 --- a/lib/platform/bitbucket-server/index.ts +++ b/lib/platform/bitbucket-server/index.ts @@ -408,6 +408,7 @@ export async function getBranchStatus( } if (!git.branchExists(branchName)) { + logger.debug('Branch does not exist - cannot fetch status'); throw new Error(REPOSITORY_CHANGED); } @@ -604,6 +605,9 @@ export async function addReviewers( err.statusCode === 409 && !utils.isInvalidReviewersResponse(err) ) { + logger.debug( + '409 response to adding reviewers - has repository changed?' + ); throw new Error(REPOSITORY_CHANGED); } else { throw err; diff --git a/lib/util/git/index.ts b/lib/util/git/index.ts index 53d2f382998b6210d1f3cd896906ef10e07ab71e..a5bc85338c7ae42e4e5a86c8b696bd433e069816 100644 --- a/lib/util/git/index.ts +++ b/lib/util/git/index.ts @@ -11,7 +11,6 @@ import { join } from 'upath'; import { configFileNames } from '../../config/app-strings'; import { CONFIG_VALIDATION, - REPOSITORY_CHANGED, REPOSITORY_DISABLED, REPOSITORY_EMPTY, SYSTEM_INSUFFICIENT_DISK_SPACE, @@ -697,8 +696,9 @@ export async function commitFiles({ logger.error({ err }, 'Error committing files.'); return null; } - logger.debug({ err }, 'Error committing files'); - throw new Error(REPOSITORY_CHANGED); + logger.debug({ err }, 'Unknown error committing files'); + // We don't know why this happened, so this will cause bubble up to a branch error + throw err; } } diff --git a/lib/util/http/github.ts b/lib/util/http/github.ts index 178793424bfe9eeb5bb8116da3d33c9dd499201a..d2424f8d06816b7b33a294ee063e6f5be9f72786 100644 --- a/lib/util/http/github.ts +++ b/lib/util/http/github.ts @@ -109,6 +109,7 @@ function handleGotError( ) { throw err; } else if (err.body?.errors?.find((e: any) => e.code === 'invalid')) { + logger.debug({ err }, 'Received invalid response - aborting'); throw new Error(REPOSITORY_CHANGED); } logger.debug({ err }, '422 Error thrown from GitHub'); diff --git a/lib/workers/branch/check-existing.ts b/lib/workers/branch/check-existing.ts index 40ae19b4d6c9b3746c157fd1813ddb0ddfb426fa..c59aaa3ea61ad2b80c75e78f6e32490bafda1486 100644 --- a/lib/workers/branch/check-existing.ts +++ b/lib/workers/branch/check-existing.ts @@ -24,7 +24,7 @@ export async function prAlreadyExisted( const prDetails = await platform.getPr(pr.number); // istanbul ignore if if (prDetails.state === PrState.Open) { - logger.debug('PR reopened'); + logger.debug('PR reopened - aborting run'); throw new Error(REPOSITORY_CHANGED); } return pr; diff --git a/lib/workers/branch/index.ts b/lib/workers/branch/index.ts index 8835a0eb11b56ac2514c9110ed0865c9f164ea05..717fdcf4fd54064406813465c2bcae9802282f2f 100644 --- a/lib/workers/branch/index.ts +++ b/lib/workers/branch/index.ts @@ -560,6 +560,7 @@ export async function processBranch( } } catch (err) /* istanbul ignore next */ { if (err.statusCode === 404) { + logger.debug({ err }, 'Received a 404 error - aborting run'); throw new Error(REPOSITORY_CHANGED); } if (err.message === PLATFORM_RATE_LIMIT_EXCEEDED) {