Skip to content

Commit

Permalink
updated error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
briantstephan committed Oct 16, 2023
1 parent 673dae2 commit d855b69
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
6 changes: 5 additions & 1 deletion packages/pages/src/generate/features/features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ const handler = async ({ scope }: { scope: string }): Promise<void> => {
projectStructure.getTemplatePaths()
);

await createTemplatesJson(templateFilepaths, projectStructure, "FEATURES");
try {
await createTemplatesJson(templateFilepaths, projectStructure, "FEATURES");
} catch (error) {
console.error(error);
}
};

export const featureCommand = (program: Command) => {
Expand Down
9 changes: 4 additions & 5 deletions packages/pages/src/generate/templates/createTemplatesJson.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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 };
Expand Down

0 comments on commit d855b69

Please sign in to comment.