From 67a2538b4d036dfa3ab9cb9e8cafca3d58724809 Mon Sep 17 00:00:00 2001 From: iCrawl Date: Wed, 8 Nov 2023 02:22:51 +0100 Subject: [PATCH] fix: handle errors gracefully --- apps/website/src/app/docAPI.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/website/src/app/docAPI.ts b/apps/website/src/app/docAPI.ts index c010caf0b..ca476a85d 100644 --- a/apps/website/src/app/docAPI.ts +++ b/apps/website/src/app/docAPI.ts @@ -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 ?? {}; }