diff --git a/lib/config/presets/bitbucket-server/index.ts b/lib/config/presets/bitbucket-server/index.ts index b79376a7c9028c4ce7dd17303a7805ee83c1ffb0..7bb1f1e79b891e7c7486a3303908a1c788437ca8 100644 --- a/lib/config/presets/bitbucket-server/index.ts +++ b/lib/config/presets/bitbucket-server/index.ts @@ -36,10 +36,7 @@ export async function fetchJSONFile( if (err instanceof ExternalHostError) { throw err; } - logger.debug( - { statusCode: err.statusCode, url: `${endpoint}${url}` }, - `Failed to retrieve ${fileName} from repo` - ); + logger.debug(`Preset file ${fileName} not found in ${repo}`); throw new Error(PRESET_DEP_NOT_FOUND); } if (!res.body.isLastPage) { diff --git a/lib/config/presets/gitea/index.ts b/lib/config/presets/gitea/index.ts index ae164daa28b438c8ff4cccb8b60d2065440d124f..dfc8884396195f8aeb1729b5f834a0c67b8d9930 100644 --- a/lib/config/presets/gitea/index.ts +++ b/lib/config/presets/gitea/index.ts @@ -24,10 +24,7 @@ export async function fetchJSONFile( if (err instanceof ExternalHostError) { throw err; } - logger.debug( - { statusCode: err.statusCode, repo, fileName }, - `Failed to retrieve ${fileName} from repo` - ); + logger.debug(`Preset file ${fileName} not found in ${repo}`); throw new Error(PRESET_DEP_NOT_FOUND); } diff --git a/lib/config/presets/github/index.ts b/lib/config/presets/github/index.ts index 272e5afd1b03f205d889269f12d0065992f77221..315c5125942ca81b82e58bd614f874c345265e80 100644 --- a/lib/config/presets/github/index.ts +++ b/lib/config/presets/github/index.ts @@ -30,10 +30,7 @@ export async function fetchJSONFile( if (err instanceof ExternalHostError) { throw err; } - logger.debug( - { statusCode: err.statusCode, url }, - `Failed to retrieve ${fileName} from repo` - ); + logger.debug(`Preset file ${fileName} not found in ${repo}`); throw new Error(PRESET_DEP_NOT_FOUND); } diff --git a/lib/config/presets/gitlab/index.ts b/lib/config/presets/gitlab/index.ts index c0b24f6cf8e0f95764da840fefb35aee6ee42c78..edf601a9c2b42e7f48326b238550d82e60a93334 100644 --- a/lib/config/presets/gitlab/index.ts +++ b/lib/config/presets/gitlab/index.ts @@ -57,10 +57,7 @@ export async function fetchJSONFile( if (err instanceof ExternalHostError) { throw err; } - logger.debug( - { statusCode: err.statusCode, url }, - `Failed to retrieve ${fileName} from repo` - ); + logger.debug(`Preset file ${fileName} not found in ${repo}`); throw new Error(PRESET_DEP_NOT_FOUND); } diff --git a/lib/config/presets/local/common.ts b/lib/config/presets/local/common.ts index 7648fdd56f313ebff850082afd991ab7058d4b91..c4a0401d95673780963b788fb1aa07ad7b017360 100644 --- a/lib/config/presets/local/common.ts +++ b/lib/config/presets/local/common.ts @@ -17,10 +17,7 @@ export async function fetchJSONFile( throw err; } - logger.debug( - { err, repo, fileName }, - `Failed to retrieve ${fileName} from repo ${repo}` - ); + logger.debug(`Preset file ${fileName} not found in ${repo}`); throw new Error(PRESET_DEP_NOT_FOUND); } diff --git a/lib/modules/datasource/npm/get.ts b/lib/modules/datasource/npm/get.ts index 21e450f379ed872c94324271a6e461ea405b035c..074d53044dff815a35811301a941a29e5549aa3a 100644 --- a/lib/modules/datasource/npm/get.ts +++ b/lib/modules/datasource/npm/get.ts @@ -157,35 +157,12 @@ export async function getDependency( } return dep; } catch (err) { - if (err.statusCode === 401 || err.statusCode === 403) { - logger.debug( - { - packageUrl, - err, - statusCode: err.statusCode, - packageName, - }, - `Dependency lookup failure: unauthorized` - ); - return null; - } - if (err.statusCode === 402) { - logger.debug( - { - packageUrl, - err, - statusCode: err.statusCode, - packageName, - }, - `Dependency lookup failure: payment required` - ); - return null; - } - if (err.statusCode === 404 || err.code === 'ENOTFOUND') { - logger.debug( - { err, packageName }, - `Dependency lookup failure: not found` - ); + const ignoredStatusCodes = [401, 402, 403, 404]; + const ignoredResponseCodes = ['ENOTFOUND']; + if ( + ignoredStatusCodes.includes(err.statusCode) || + ignoredResponseCodes.includes(err.code) + ) { return null; } if (uri.host === 'registry.npmjs.org') { diff --git a/lib/util/http/github.ts b/lib/util/http/github.ts index 8de822fba22abae56012cffe3b540038746dd8ee..0b2401bedee9b8a41090a8785f3372a3137d140a 100644 --- a/lib/util/http/github.ts +++ b/lib/util/http/github.ts @@ -154,11 +154,6 @@ function handleGotError( ) { return err; } - if (err.statusCode === 404) { - logger.debug({ url: path }, 'GitHub 404'); - } else { - logger.debug({ err }, 'Unknown GitHub error'); - } return err; } diff --git a/lib/util/http/index.ts b/lib/util/http/index.ts index 2835a46a0a77e134cb9ddc3193076e1fc5f55560..aa9c99d392373a2e3197eb6a4e9d7f08917213e0 100644 --- a/lib/util/http/index.ts +++ b/lib/util/http/index.ts @@ -89,6 +89,12 @@ async function gotTask<T>( duration = error.timings?.phases.total ?? /* istanbul ignore next: can't be tested */ 0; + const method = options.method?.toUpperCase() ?? 'GET'; + const code = error.code ?? 'UNKNOWN'; + const retryCount = error.response?.retryCount ?? -1; + logger.debug( + `${method} ${url} = (code=${code}, statusCode=${statusCode} retryCount=${retryCount}, duration=${duration})` + ); } throw error; diff --git a/lib/workers/repository/process/lookup/index.ts b/lib/workers/repository/process/lookup/index.ts index f79d040d38698b4104368a7a78133b03c241a42e..517220a8e5ff5377f6c40403695592d23b313588 100644 --- a/lib/workers/repository/process/lookup/index.ts +++ b/lib/workers/repository/process/lookup/index.ts @@ -82,7 +82,7 @@ export async function lookupUpdates( // If dependency lookup fails then warn and return const warning: ValidationMessage = { topic: depName, - message: `Failed to look up dependency ${depName}`, + message: `Failed to look up ${datasource} dependency ${depName}`, }; logger.debug({ dependency: depName, packageFile }, warning.message); // TODO: return warnings in own field