diff --git a/src/db/data/noticeHandler.ts b/src/db/data/noticeHandler.ts index f901e14..2b09f3c 100644 --- a/src/db/data/noticeHandler.ts +++ b/src/db/data/noticeHandler.ts @@ -208,7 +208,7 @@ export const saveWhalebeToDB = async (): Promise => { const whalebeDatas = await whalebeCrawling(); // TODO: 웨일비 크롤링하는 데이터 추가해야함 - const promises = whalebeDatas.map((data) => { + const promises = whalebeDatas.map(async (data) => { const values = [ data.title, data.link, @@ -217,7 +217,12 @@ export const saveWhalebeToDB = async (): Promise => { data.imgurl, ]; - return db.execute(query, values); + try { + const result = await db.execute(query, values); + return result; + } catch (error) { + console.log(error.message); + } }); Promise.all(promises); diff --git a/src/hooks/notificateToSlack.ts b/src/hooks/notificateToSlack.ts index 264a4c6..66fbfff 100644 --- a/src/hooks/notificateToSlack.ts +++ b/src/hooks/notificateToSlack.ts @@ -14,7 +14,8 @@ const notificationToSlack = async (text: string): Promise => { text, }); } catch (error) { - console.error(error); + console.error(error.message); + return notificationToSlack(text); } return; };