Skip to content

Commit ea3f9f6

Browse files
Techbot121Meta Construct
authored andcommitted
don't crash if bans can't be fetched
1 parent 017b6b2 commit ea3f9f6

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

app/services/Bans.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@ export class Bans extends Service {
2323
private lastUpdate = 0;
2424

2525
async updateCache(): Promise<void> {
26-
const res = await axios.get<Array<MetaBan>>("http://g2.metastruct.net/bans");
27-
if (res.status === 200) {
28-
this.banCache = res.data;
29-
}
30-
this.lastUpdate = Date.now();
26+
try {
27+
const res = await axios.get<Array<MetaBan>>("http://g2.metastruct.net/bans");
28+
if (res.status === 200) {
29+
this.banCache = res.data;
30+
}
31+
this.lastUpdate = Date.now();
32+
} catch {}
3133
}
3234

3335
async getBan(steamid: string, force?: boolean): Promise<MetaBan | undefined> {

0 commit comments

Comments
 (0)