From 29e865aee17ebe7021065c0bf6eb9bd208046a0f Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Fri, 10 Mar 2023 06:48:40 +0100 Subject: [PATCH] chore: better hashicorp versioning logging --- lib/modules/versioning/hashicorp/convertor.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/modules/versioning/hashicorp/convertor.ts b/lib/modules/versioning/hashicorp/convertor.ts index cf5ba17cdb..9f784f58f8 100644 --- a/lib/modules/versioning/hashicorp/convertor.ts +++ b/lib/modules/versioning/hashicorp/convertor.ts @@ -1,3 +1,4 @@ +import { logger } from '../../../logger'; import { regEx } from '../../../util/regex'; /** @@ -16,10 +17,18 @@ export function hashicorp2npm(input: string): string { regEx(/^\s*(|=|!=|>|<|>=|<=|~>)\s*v?((\d+)(\.\d+){0,2}[\w-+]*)\s*$/) ); if (!r) { - throw new Error('invalid hashicorp constraint'); + logger.warn( + { constraint: input, element: single }, + 'Invalid hashicorp constraint' + ); + throw new Error('Invalid hashicorp constraint'); } if (r[1] === '!=') { - throw new Error('unsupported != in hashicorp constraint'); + logger.warn( + { constraint: input, element: single }, + 'Unsupported hashicorp constraint' + ); + throw new Error('Unsupported hashicorp constraint'); } return { operator: r[1], -- GitLab