added try catch to haifa
This commit is contained in:
parent
dbdf76554b
commit
265a182d8f
1 changed files with 8 additions and 1 deletions
|
@ -10,7 +10,10 @@ import moment from "moment"; // require
|
||||||
export default class GameSource {
|
export default class GameSource {
|
||||||
async getGamesFromHaifa(): Promise<GoogleCalendarEvent[]> {
|
async getGamesFromHaifa(): Promise<GoogleCalendarEvent[]> {
|
||||||
const sourceUrl = `http://mhaifafc.com/games?lang=en`;
|
const sourceUrl = `http://mhaifafc.com/games?lang=en`;
|
||||||
|
console.log('Trying to get games from Haifa...');
|
||||||
|
try {
|
||||||
const result = await axios.get(sourceUrl);
|
const result = await axios.get(sourceUrl);
|
||||||
|
|
||||||
const parsedResult = parse(result.data.toString());
|
const parsedResult = parse(result.data.toString());
|
||||||
const gameBoxs = parsedResult.querySelectorAll(".game-box");
|
const gameBoxs = parsedResult.querySelectorAll(".game-box");
|
||||||
|
|
||||||
|
@ -62,6 +65,10 @@ export default class GameSource {
|
||||||
// return [];
|
// return [];
|
||||||
return games;
|
return games;
|
||||||
}
|
}
|
||||||
|
catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private findTime(headerSplit: string[]) {
|
private findTime(headerSplit: string[]) {
|
||||||
let time = '';
|
let time = '';
|
||||||
|
|
Loading…
Reference in a new issue