Make table creation error handling more robust

This commit is contained in:
Sam Becker 2023-09-06 18:57:27 -05:00
parent 9627d912b4
commit 7964435ed7

View File

@ -171,7 +171,7 @@ export const getPhotos = async (
try { try {
photos = await getPhotosRequest(limit, offset); photos = await getPhotosRequest(limit, offset);
} catch (e: any) { } catch (e: any) {
if (e.message === 'relation "photos" does not exist') { if (/relation "photos" does not exist/i.test(e.message)) {
console.log( console.log(
'Creating table "photos" because it did not exist', 'Creating table "photos" because it did not exist',
); );