Skip to content

Commit

Permalink
add null check
Browse files Browse the repository at this point in the history
  • Loading branch information
hofmeister committed Dec 12, 2023
1 parent 2a40ae5 commit 2e732cf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2e732cf

Please sign in to comment.