From 2e732cf79de27851cacd40b43583959eb3ac914e Mon Sep 17 00:00:00 2001 From: Henrik Hofmeister Date: Tue, 12 Dec 2023 13:16:48 +0100 Subject: [PATCH] add null check --- src/utils.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/utils.ts b/src/utils.ts index 5e2fc36..d95f2f9 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -8,6 +8,9 @@ export const RESOURCE_TYPE = 'kapeta/resource-type-mongodb'; export const PORT_TYPE = 'mongodb'; export async function createDBURI(provider:ConfigProvider, resourceName: string) { const dbInfo = await provider.getResourceInfo(RESOURCE_TYPE, PORT_TYPE, resourceName); + if (!dbInfo) { + throw new Error(`Resource ${resourceName} not found`); + } const dbName = dbInfo.options && dbInfo.options.dbName ? dbInfo.options.dbName