feat: provide clear message when app is not found
This commit is contained in:
@@ -22,7 +22,11 @@ const apps = fs
|
|||||||
return apps;
|
return apps;
|
||||||
}, {} as TApps);
|
}, {} 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;
|
return (await apps[appKey]).default;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,7 +35,7 @@ function stripFunctions<C>(data: C): C {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const getApp = async (appKey: string, stripFuncs = true) => {
|
const getApp = async (appKey: string, stripFuncs = true) => {
|
||||||
let appData: IApp = cloneDeep(await getDefaultExport(appKey));
|
let appData: IApp = cloneDeep(await getAppDefaultExport(appKey));
|
||||||
|
|
||||||
if (appData.auth) {
|
if (appData.auth) {
|
||||||
appData = addAuthenticationSteps(appData);
|
appData = addAuthenticationSteps(appData);
|
||||||
|
Reference in New Issue
Block a user