From d67f5a69b283aea4735b8b64ca5ee0505086fb1d Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Sun, 9 Feb 2020 07:20:21 +0100 Subject: [PATCH] fix(helm-values): better extract error handling --- lib/manager/helm-values/extract.ts | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/lib/manager/helm-values/extract.ts b/lib/manager/helm-values/extract.ts index b8d1b120bc..7226fa633f 100644 --- a/lib/manager/helm-values/extract.ts +++ b/lib/manager/helm-values/extract.ts @@ -37,24 +37,23 @@ function findDependencies( } export function extractPackageFile(content: string): PackageFile { + let parsedContent; try { // a parser that allows extracting line numbers would be preferable, with // the current approach we need to match anything we find again during the update - const parsedContent = yaml.safeLoad(content, { json: true }); - - logger.debug( - { parsedContent }, - 'Trying to find dependencies in helm-values' - ); + parsedContent = yaml.safeLoad(content, { json: true }); + } catch (err) { + logger.info({ err }, 'Failed to parse helm-values YAML'); + return null; + } + try { const deps = findDependencies(parsedContent, []); - if (deps.length) { logger.debug({ deps }, 'Found dependencies in helm-values'); return { deps }; } - } catch (err) { - logger.error({ err }, 'Failed to parse helm-values file'); + } catch (err) /* istanbul ignore next */ { + logger.error({ err }, 'Error parsing helm-values parsed content'); } - return null; } -- GitLab