From d855b6929c94fe8e70861eac347377a26e2813e6 Mon Sep 17 00:00:00 2001 From: Brian Stephan Date: Mon, 16 Oct 2023 15:22:40 -0400 Subject: [PATCH] updated error handling --- packages/pages/src/generate/features/features.ts | 6 +++++- .../pages/src/generate/templates/createTemplatesJson.ts | 9 ++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/pages/src/generate/features/features.ts b/packages/pages/src/generate/features/features.ts index f563fa5cc..0c4fe3534 100644 --- a/packages/pages/src/generate/features/features.ts +++ b/packages/pages/src/generate/features/features.ts @@ -9,7 +9,11 @@ const handler = async ({ scope }: { scope: string }): Promise => { projectStructure.getTemplatePaths() ); - await createTemplatesJson(templateFilepaths, projectStructure, "FEATURES"); + try { + await createTemplatesJson(templateFilepaths, projectStructure, "FEATURES"); + } catch (error) { + console.error(error); + } }; export const featureCommand = (program: Command) => { diff --git a/packages/pages/src/generate/templates/createTemplatesJson.ts b/packages/pages/src/generate/templates/createTemplatesJson.ts index f05b6e98e..4ebf548a3 100644 --- a/packages/pages/src/generate/templates/createTemplatesJson.ts +++ b/packages/pages/src/generate/templates/createTemplatesJson.ts @@ -1,5 +1,5 @@ import fs from "fs-extra"; -import isEqual from "lodash/isEqual"; +import isEqual from "lodash/isEqual.js"; import path from "path"; import { FeaturesConfig, @@ -97,11 +97,10 @@ export const getTemplatesConfig = ( streams.push(streamConfig); continue; } - if (!isEqual(matchingStreamConfig, streamConfig)) { - throw new Error( - "Conflicting configurations found for stream ID ${streamConfig.$id}" - ); + if (isEqual(matchingStreamConfig, streamConfig)) { + continue; } + throw `Conflicting configurations found for stream ID: ${streamConfig.$id}`; } return { features, streams };