Skip to content

Commit

Permalink
fix(storybook) More robust initial CTO support in model builder
Browse files Browse the repository at this point in the history
Signed-off-by: jeromesimeon <[email protected]>
  • Loading branch information
jeromesimeon committed Sep 28, 2021
1 parent acc72d5 commit 9109e0a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/storybook/src/stories/3-ConcertoForm.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,12 @@ export const ModelBuilder = () => {
});

const cto = text('Initial CTO', TestModel);
const json = MetaModel.ctoToMetaModel(cto);
let json = null;
try {
json = MetaModel.ctoToMetaModel(cto);
} catch (error) {
console.log(`Invalid CTO: [${error.message}]`);
}
const handleValueChange = async (json) => {
let newCto;
try {
Expand All @@ -117,7 +122,7 @@ export const ModelBuilder = () => {
const roundtripForSafety = MetaModel.ctoToMetaModel(newCto);
await action("New CTO")(newCto);
} catch (error) {
await action("Invalid CTO")(`${newCto}\n[${error.message}]`);
await action("Invalid CTO")(`[${error.message}]\n${newCto}`);
}
};

Expand Down

0 comments on commit 9109e0a

Please sign in to comment.