diff --git a/packages/cli/commands/cms/convertFields.js b/packages/cli/commands/cms/convertFields.js index 9f59f7a46..cc681b4b7 100644 --- a/packages/cli/commands/cms/convertFields.js +++ b/packages/cli/commands/cms/convertFields.js @@ -12,6 +12,7 @@ const { } = require('@hubspot/cli-lib/lib/handleFieldsJs'); const { trackConvertFieldsUsage } = require('../../lib/usageTracking'); +const { logErrorInstance } = require('@hubspot/cli-lib/errorHandlers'); const i18nKey = 'cli.commands.convertFields'; exports.command = 'convert-fields'; @@ -54,7 +55,12 @@ exports.handler = async options => { if (fieldsJs.rejected) return; fieldsJs.saveOutput(); } else if (stats.isDirectory()) { - const filePaths = await walk(src); + let filePaths = []; + try { + filePaths = await walk(src); + } catch (e) { + logErrorInstance(e); + } const allowedFilePaths = filePaths .filter(file => { if (!isAllowedExtension(file)) { diff --git a/packages/cli/lib/projectStructure.js b/packages/cli/lib/projectStructure.js index 201169d80..a24a842ef 100644 --- a/packages/cli/lib/projectStructure.js +++ b/packages/cli/lib/projectStructure.js @@ -2,6 +2,7 @@ const fs = require('fs'); const path = require('path'); const { walk } = require('@hubspot/local-dev-lib/fs'); const { logger } = require('@hubspot/cli-lib/logger'); +const { logErrorInstance } = require('./errorHandlers/standardErrors'); const COMPONENT_TYPES = Object.freeze({ app: 'app', @@ -73,8 +74,13 @@ function getIsLegacyApp(appConfig, appPath) { async function findProjectComponents(projectSourceDir) { const components = []; + let projectFiles = []; - const projectFiles = await walk(projectSourceDir); + try { + projectFiles = await walk(projectSourceDir); + } catch (e) { + logErrorInstance(e); + } projectFiles.forEach(projectFile => { // Find app components diff --git a/packages/cli/lib/upload.js b/packages/cli/lib/upload.js index 34b8ddaf6..c4337f267 100644 --- a/packages/cli/lib/upload.js +++ b/packages/cli/lib/upload.js @@ -4,13 +4,19 @@ const { createIgnoreFilter } = require('@hubspot/local-dev-lib/ignoreRules'); const { fieldsJsPrompt } = require('../lib/prompts/cmsFieldPrompt'); const { isAllowedExtension } = require('@hubspot/cli-lib/path'); const { isConvertableFieldJs } = require('@hubspot/cli-lib/lib/handleFieldsJs'); +const { logErrorInstance } = require('./errorHandlers/standardErrors'); /* * Walks the src folder for files, filters them based on ignore filter. * If convertFields is true then will check for any JS fields conflicts (i.e., JS fields file and fields.json file) and prompt to resolve */ const getUploadableFileList = async (src, convertFields) => { - const filePaths = await walk(src); + let filePaths = []; + try { + filePaths = await walk(src); + } catch (e) { + logErrorInstance(e); + } const allowedFiles = filePaths .filter(file => { if (!isAllowedExtension(file)) {