From 7964435ed78b3e2bafcef1b6d54b134d666f860b Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Wed, 6 Sep 2023 18:57:27 -0500 Subject: [PATCH] Make table creation error handling more robust --- src/services/postgres.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/postgres.ts b/src/services/postgres.ts index 28b5f770..97f38e81 100644 --- a/src/services/postgres.ts +++ b/src/services/postgres.ts @@ -171,7 +171,7 @@ export const getPhotos = async ( try { photos = await getPhotosRequest(limit, offset); } catch (e: any) { - if (e.message === 'relation "photos" does not exist') { + if (/relation "photos" does not exist/i.test(e.message)) { console.log( 'Creating table "photos" because it did not exist', );