From 265a182d8fa18d2b2a385b2717b00415a09de3ef Mon Sep 17 00:00:00 2001 From: Kfir Dayan Date: Sun, 4 Feb 2024 12:54:32 +0200 Subject: [PATCH] added try catch to haifa --- src/GameSource.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/GameSource.ts b/src/GameSource.ts index b68baf1..93dec07 100644 --- a/src/GameSource.ts +++ b/src/GameSource.ts @@ -10,7 +10,10 @@ import moment from "moment"; // require export default class GameSource { async getGamesFromHaifa(): Promise { const sourceUrl = `http://mhaifafc.com/games?lang=en`; - const result = await axios.get(sourceUrl); + console.log('Trying to get games from Haifa...'); + try { + const result = await axios.get(sourceUrl); + const parsedResult = parse(result.data.toString()); const gameBoxs = parsedResult.querySelectorAll(".game-box"); @@ -62,6 +65,10 @@ export default class GameSource { // return []; return games; } + catch (error) { + console.error(error); + } + } private findTime(headerSplit: string[]) { let time = '';