From eeb209fa82170f6dc213523bc5b508ec00471ccd Mon Sep 17 00:00:00 2001 From: Camden Phalen Date: Thu, 7 Dec 2023 17:22:00 -0500 Subject: [PATCH] use local-dev-lib for accessTokenForPersonalAccessKey --- packages/cli/commands/accounts/clean.js | 5 ++++- packages/cli/lib/__tests__/validation.js | 2 +- packages/cli/lib/validation.js | 5 +++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/cli/commands/accounts/clean.js b/packages/cli/commands/accounts/clean.js index d07856b52..7477d05ed 100644 --- a/packages/cli/commands/accounts/clean.js +++ b/packages/cli/commands/accounts/clean.js @@ -1,7 +1,7 @@ const { logger } = require('@hubspot/cli-lib/logger'); const { accessTokenForPersonalAccessKey, -} = require('@hubspot/cli-lib/personalAccessKey'); +} = require('@hubspot/local-dev-lib/personalAccessKey'); const { trackCommandUsage } = require('../../lib/usageTracking'); const { i18n } = require('../../lib/lang'); @@ -21,6 +21,7 @@ const { getConfig, deleteAccount } = require('@hubspot/local-dev-lib/config'); const { isSpecifiedHubSpotAuthError, } = require('../../lib/errorHandlers/apiErrors'); +const { logErrorInstance } = require('../lib/errorHandlers/standardErrors'); const i18nKey = 'cli.commands.accounts.subcommands.clean'; @@ -69,6 +70,8 @@ exports.handler = async options => { }) ) { accountsToRemove.push(account); + } else { + logErrorInstance(error); } } } diff --git a/packages/cli/lib/__tests__/validation.js b/packages/cli/lib/__tests__/validation.js index 799b20ae7..13c4673bd 100644 --- a/packages/cli/lib/__tests__/validation.js +++ b/packages/cli/lib/__tests__/validation.js @@ -2,7 +2,7 @@ const { getAccountConfig } = require('@hubspot/local-dev-lib/config'); const { getOauthManager } = require('@hubspot/cli-lib/oauth'); const { accessTokenForPersonalAccessKey, -} = require('@hubspot/cli-lib/personalAccessKey'); +} = require('@hubspot/local-dev-lib/personalAccessKey'); const { getAccountId } = require('../commonOpts'); const { validateAccount } = require('../validation'); diff --git a/packages/cli/lib/validation.js b/packages/cli/lib/validation.js index 534582492..a4b058ed3 100644 --- a/packages/cli/lib/validation.js +++ b/packages/cli/lib/validation.js @@ -17,13 +17,14 @@ const { getAbsoluteFilePath } = require('@hubspot/local-dev-lib/path'); const { getOauthManager } = require('@hubspot/cli-lib/oauth'); const { accessTokenForPersonalAccessKey, -} = require('@hubspot/cli-lib/personalAccessKey'); +} = require('@hubspot/local-dev-lib/personalAccessKey'); const { getCwd, getExt } = require('@hubspot/local-dev-lib/path'); const { getAccountId, getMode, setLogLevel } = require('./commonOpts'); const { logDebugInfo } = require('./debugInfo'); const fs = require('fs'); const path = require('path'); const { EXIT_CODES } = require('./enums/exitCodes'); +const { logErrorInstance } = require('./errorHandlers/standardErrors'); async function loadAndValidateOptions(options, shouldValidateAccount = true) { setLogLevel(options); @@ -151,7 +152,7 @@ async function validateAccount(options) { return false; } } catch (e) { - logger.error(e.message); + logErrorInstance(e); return false; } } else if (!apiKey) {