Skip to content

Commit 29f2de3

Browse files
committed
enhance-micro-app-debugging
1 parent a8548e7 commit 29f2de3

1 file changed

Lines changed: 28 additions & 2 deletions

File tree

shell-ui/src/initFederation/ConfigurationProviders.tsx

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export function useConfigRetriever(): {
8484
retrieveConfiguration: ({ configType, name }) => {
8585
if (configType !== 'build' && configType !== 'run') {
8686
throw new Error(
87-
`Invalid configType : it should be build or run but recieved ${configType}`,
87+
`Invalid configType : it should be build or run but received ${configType}`,
8888
);
8989
}
9090

@@ -108,13 +108,39 @@ export function useConfigRetriever(): {
108108
})
109109
.map((webFinger) => webFinger.data);
110110
///TODO validate web fingers against JsonSchemas
111-
return configs.find(
111+
const config = configs.find(
112112
(webFinger) =>
113113
(webFinger.kind === 'MicroAppRuntimeConfiguration' &&
114114
webFinger.metadata.name === name) ||
115115
(webFinger.kind === 'MicroAppConfiguration' &&
116116
webFinger.metadata.kind === apps[0].kind),
117117
);
118+
119+
if (!config) {
120+
if (configType === 'build') {
121+
throw new Error(
122+
`MicroApp's MicroAppConfiguration not found for app with kind ${
123+
apps[0].kind
124+
}: Please check your MicroAppConfiguration. Here is a list of known configurations:\n ${JSON.stringify(
125+
configs,
126+
null,
127+
2,
128+
)}`,
129+
);
130+
}
131+
if (configType === 'run') {
132+
throw new Error(
133+
`MicroApp's RuntimeAppConfiguration not found for app with name ${name} and kind ${
134+
apps[0].kind
135+
}: Please check your RuntimeAppConfiguration. Here is a list of known configurations:\n ${JSON.stringify(
136+
configs,
137+
null,
138+
2,
139+
)}`,
140+
);
141+
}
142+
}
143+
return config;
118144
},
119145
};
120146
}

0 commit comments

Comments
 (0)