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

fix(helm-values): better extract error handling

parent 178e3561
No related branches found
No related tags found
No related merge requests found
...@@ -37,24 +37,23 @@ function findDependencies( ...@@ -37,24 +37,23 @@ function findDependencies(
} }
export function extractPackageFile(content: string): PackageFile { export function extractPackageFile(content: string): PackageFile {
let parsedContent;
try { try {
// a parser that allows extracting line numbers would be preferable, with // 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 // the current approach we need to match anything we find again during the update
const parsedContent = yaml.safeLoad(content, { json: true }); parsedContent = yaml.safeLoad(content, { json: true });
} catch (err) {
logger.debug( logger.info({ err }, 'Failed to parse helm-values YAML');
{ parsedContent }, return null;
'Trying to find dependencies in helm-values' }
); try {
const deps = findDependencies(parsedContent, []); const deps = findDependencies(parsedContent, []);
if (deps.length) { if (deps.length) {
logger.debug({ deps }, 'Found dependencies in helm-values'); logger.debug({ deps }, 'Found dependencies in helm-values');
return { deps }; return { deps };
} }
} catch (err) { } catch (err) /* istanbul ignore next */ {
logger.error({ err }, 'Failed to parse helm-values file'); logger.error({ err }, 'Error parsing helm-values parsed content');
} }
return null; return null;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment