fix: handle errors gracefully

This commit is contained in:
iCrawl
2023-11-08 02:22:51 +01:00
parent 7208d69c05
commit 67a2538b4d

View File

@@ -45,7 +45,7 @@ export async function fetchModelJSON(packageName: string, version: string): Prom
]);
// @ts-expect-error: https://github.com/planetscale/database-js/issues/71
return rows[0].data;
return rows[0]?.data ?? {};
}
const { rows } = await sql.execute('select data from documentation where name = ? and version = ?', [
@@ -54,5 +54,5 @@ export async function fetchModelJSON(packageName: string, version: string): Prom
]);
// @ts-expect-error: https://github.com/planetscale/database-js/issues/71
return rows[0].data;
return rows[0]?.data ?? {};
}