From 9109e0aed421c33e39880d2b6709708bb58fda29 Mon Sep 17 00:00:00 2001 From: jeromesimeon Date: Tue, 27 Jul 2021 11:05:04 -0400 Subject: [PATCH] fix(storybook) More robust initial CTO support in model builder Signed-off-by: jeromesimeon --- packages/storybook/src/stories/3-ConcertoForm.stories.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/storybook/src/stories/3-ConcertoForm.stories.js b/packages/storybook/src/stories/3-ConcertoForm.stories.js index f6a3ca1..6adfe3a 100644 --- a/packages/storybook/src/stories/3-ConcertoForm.stories.js +++ b/packages/storybook/src/stories/3-ConcertoForm.stories.js @@ -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 { @@ -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}`); } };