From 68ffb2b9a601ba60470419cb4c7d17e15a16aee4 Mon Sep 17 00:00:00 2001 From: Georgiana-Elena Maxim <136567038+gemaxim@users.noreply.github.com> Date: Thu, 27 Jun 2024 13:32:34 +0300 Subject: [PATCH] fix: handle error from pnpm FF check (#5348) --- src/cli/commands/monitor/index.ts | 10 +++++++++- src/lib/snyk-test/index.js | 8 ++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/cli/commands/monitor/index.ts b/src/cli/commands/monitor/index.ts index 6e16b3cc7e..4a60e28729 100644 --- a/src/cli/commands/monitor/index.ts +++ b/src/cli/commands/monitor/index.ts @@ -159,7 +159,15 @@ export default async function monitor(...args0: MethodArgs): Promise { ); } - const hasPnpmSupport = await hasFeatureFlag(PNPM_FEATURE_FLAG, options); + let hasPnpmSupport = false; + try { + hasPnpmSupport = (await hasFeatureFlag( + PNPM_FEATURE_FLAG, + options, + )) as boolean; + } catch (err) { + hasPnpmSupport = false; + } const featureFlags = hasPnpmSupport ? new Set([PNPM_FEATURE_FLAG]) diff --git a/src/lib/snyk-test/index.js b/src/lib/snyk-test/index.js index aa0148c25a..ac8840f698 100644 --- a/src/lib/snyk-test/index.js +++ b/src/lib/snyk-test/index.js @@ -29,9 +29,13 @@ async function test(root, options, callback) { } async function executeTest(root, options) { + let hasPnpmSupport = false; + try { + hasPnpmSupport = await hasFeatureFlag(PNPM_FEATURE_FLAG, options); + } catch (err) { + hasPnpmSupport = false; + } try { - const hasPnpmSupport = await hasFeatureFlag(PNPM_FEATURE_FLAG, options); - const featureFlags = hasPnpmSupport ? new Set([PNPM_FEATURE_FLAG]) : new Set([]);