feat: provide clear message when app is not found

This commit is contained in:
Ali BARIN
2023-03-12 09:59:27 +00:00
parent 571901f333
commit 97da370301

View File

@@ -22,7 +22,11 @@ const apps = fs
return apps;
}, {} as TApps);
async function getDefaultExport(appKey: string) {
async function getAppDefaultExport(appKey: string) {
if (!Object.prototype.hasOwnProperty.call(apps, appKey)) {
throw new Error(`An application with the "${appKey}" key couldn't be found.`);
}
return (await apps[appKey]).default;
}
@@ -31,7 +35,7 @@ function stripFunctions<C>(data: C): C {
}
const getApp = async (appKey: string, stripFuncs = true) => {
let appData: IApp = cloneDeep(await getDefaultExport(appKey));
let appData: IApp = cloneDeep(await getAppDefaultExport(appKey));
if (appData.auth) {
appData = addAuthenticationSteps(appData);