From 2a39c42852f5bc9949895d6943325e986fdba634 Mon Sep 17 00:00:00 2001 From: Branden Rodgers Date: Tue, 13 Feb 2024 16:38:32 -0500 Subject: [PATCH] bump local-dev-lib dep and use better error logging util --- packages/cli/commands/secrets/addSecret.js | 9 ++++----- packages/cli/commands/secrets/deleteSecret.js | 9 ++++----- packages/cli/commands/secrets/listSecrets.js | 9 ++++----- packages/cli/commands/secrets/updateSecret.js | 9 ++++----- packages/cli/package.json | 2 +- packages/serverless-dev-runtime/package.json | 2 +- packages/webpack-cms-plugins/package.json | 2 +- yarn.lock | 8 ++++---- 8 files changed, 23 insertions(+), 27 deletions(-) diff --git a/packages/cli/commands/secrets/addSecret.js b/packages/cli/commands/secrets/addSecret.js index a3a103e6f..43f16ccdd 100644 --- a/packages/cli/commands/secrets/addSecret.js +++ b/packages/cli/commands/secrets/addSecret.js @@ -1,6 +1,6 @@ const { logger } = require('@hubspot/cli-lib/logger'); const { - logServerlessFunctionApiErrorInstance, + logApiErrorInstance, ApiErrorContext, } = require('../../lib/errorHandlers/apiErrors'); const { addSecret } = require('@hubspot/local-dev-lib/api/secrets'); @@ -41,15 +41,14 @@ exports.handler = async options => { secretName, }) ); - } catch (e) { + } catch (err) { logger.error( i18n(`${i18nKey}.errors.add`, { secretName, }) ); - await logServerlessFunctionApiErrorInstance( - accountId, - e, + logApiErrorInstance( + err, new ApiErrorContext({ request: 'add secret', accountId, diff --git a/packages/cli/commands/secrets/deleteSecret.js b/packages/cli/commands/secrets/deleteSecret.js index decb15124..8c171fcf4 100644 --- a/packages/cli/commands/secrets/deleteSecret.js +++ b/packages/cli/commands/secrets/deleteSecret.js @@ -1,7 +1,7 @@ const { logger } = require('@hubspot/cli-lib/logger'); const { - logServerlessFunctionApiErrorInstance, ApiErrorContext, + logApiErrorInstance, } = require('../../lib/errorHandlers/apiErrors'); const { deleteSecret } = require('@hubspot/local-dev-lib/api/secrets'); @@ -38,15 +38,14 @@ exports.handler = async options => { secretName, }) ); - } catch (e) { + } catch (err) { logger.error( i18n(`${i18nKey}.errors.delete`, { secretName, }) ); - await logServerlessFunctionApiErrorInstance( - accountId, - e, + logApiErrorInstance( + err, new ApiErrorContext({ request: 'delete a secret', accountId, diff --git a/packages/cli/commands/secrets/listSecrets.js b/packages/cli/commands/secrets/listSecrets.js index 6d88a73f8..daab8d5a5 100644 --- a/packages/cli/commands/secrets/listSecrets.js +++ b/packages/cli/commands/secrets/listSecrets.js @@ -1,6 +1,6 @@ const { logger } = require('@hubspot/cli-lib/logger'); const { - logServerlessFunctionApiErrorInstance, + logApiErrorInstance, ApiErrorContext, } = require('../../lib/errorHandlers/apiErrors'); const { fetchSecrets } = require('@hubspot/local-dev-lib/api/secrets'); @@ -36,11 +36,10 @@ exports.handler = async options => { logger.group(groupLabel); results.forEach(secret => logger.log(secret)); logger.groupEnd(groupLabel); - } catch (e) { + } catch (err) { logger.error(i18n(`${i18nKey}.errors.list`)); - await logServerlessFunctionApiErrorInstance( - accountId, - e, + logApiErrorInstance( + err, new ApiErrorContext({ request: 'add secret', accountId, diff --git a/packages/cli/commands/secrets/updateSecret.js b/packages/cli/commands/secrets/updateSecret.js index 99a545180..0eb20104d 100644 --- a/packages/cli/commands/secrets/updateSecret.js +++ b/packages/cli/commands/secrets/updateSecret.js @@ -1,7 +1,7 @@ const { logger } = require('@hubspot/cli-lib/logger'); const { - logServerlessFunctionApiErrorInstance, ApiErrorContext, + logApiErrorInstance, } = require('../../lib/errorHandlers/apiErrors'); const { updateSecret } = require('@hubspot/local-dev-lib/api/secrets'); @@ -42,15 +42,14 @@ exports.handler = async options => { }) ); logger.log(i18n(`${i18nKey}.success.updateExplanation`)); - } catch (e) { + } catch (err) { logger.error( i18n(`${i18nKey}.errors.update`, { secretName, }) ); - await logServerlessFunctionApiErrorInstance( - accountId, - e, + logApiErrorInstance( + err, new ApiErrorContext({ request: 'update secret', accountId, diff --git a/packages/cli/package.json b/packages/cli/package.json index d61109601..49915c196 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -9,7 +9,7 @@ }, "dependencies": { "@hubspot/cli-lib": "^9.0.0", - "@hubspot/local-dev-lib": "^0.3.1", + "@hubspot/local-dev-lib": "^0.3.3", "@hubspot/serverless-dev-runtime": "5.1.3", "@hubspot/ui-extensions-dev-server": "0.8.9", "archiver": "^5.3.0", diff --git a/packages/serverless-dev-runtime/package.json b/packages/serverless-dev-runtime/package.json index 20ee03654..d13ca5579 100644 --- a/packages/serverless-dev-runtime/package.json +++ b/packages/serverless-dev-runtime/package.json @@ -7,7 +7,7 @@ "license": "Apache-2.0", "dependencies": { "@hubspot/cli-lib": "^9.0.0", - "@hubspot/local-dev-lib": "^0.3.1", + "@hubspot/local-dev-lib": "^0.3.3", "body-parser": "^1.19.0", "chalk": "^4.1.0", "chokidar": "^3.4.3", diff --git a/packages/webpack-cms-plugins/package.json b/packages/webpack-cms-plugins/package.json index 55ad445b6..87a6c3b1b 100644 --- a/packages/webpack-cms-plugins/package.json +++ b/packages/webpack-cms-plugins/package.json @@ -18,7 +18,7 @@ }, "dependencies": { "@hubspot/cli-lib": "^9.0.0", - "@hubspot/local-dev-lib": "^0.3.1" + "@hubspot/local-dev-lib": "^0.3.3" }, "gitHead": "0659fd19cabc3645af431b177c11d0c1b089e0f8" } diff --git a/yarn.lock b/yarn.lock index 5114c3fa3..9e3e41e01 100644 --- a/yarn.lock +++ b/yarn.lock @@ -537,10 +537,10 @@ table "^6.6.0" unixify "1.0.0" -"@hubspot/local-dev-lib@^0.3.1": - version "0.3.1" - resolved "https://registry.yarnpkg.com/@hubspot/local-dev-lib/-/local-dev-lib-0.3.1.tgz#2137d3d41be41c50193346d15b8f6a8a039adf1c" - integrity sha512-w3Wjiadw0sJw2akRYbU4PfDK9eXDmm9iEMPNgMN7NH43U68+l2BgDK+KFk5z9bOftHZg1IdF9JuQmSo45q4Ddg== +"@hubspot/local-dev-lib@^0.3.3": + version "0.3.3" + resolved "https://registry.yarnpkg.com/@hubspot/local-dev-lib/-/local-dev-lib-0.3.3.tgz#fe491d047c44926f1e1068dff17cc41d42830630" + integrity sha512-G9VSAtHvtE6WglJrSOIh9M8zUUYmVge+tq5Wt6FvZWdH2XMGQYO5GuQOp6X/eoOhgAyWNgcZPOMsJNSmrLNLvw== dependencies: address "^2.0.1" axios "^1.3.5"