Skip to content

Commit b686d60

Browse files
committed
Fix issue where network request times out and causes uncaught exception
1 parent a59787f commit b686d60

File tree

2 files changed

+118
-100
lines changed

2 files changed

+118
-100
lines changed

src/ts/backend/network.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,18 @@ export async function pingUpdate(): Promise<PingUpdate> {
2222
}
2323

2424
export async function webUpdate(): Promise<WebUpdate> {
25-
const siWebStats = await si.inetChecksite(getWebUrl());
26-
return {
27-
latency: siWebStats.ms,
28-
responseCode: siWebStats.status,
25+
try {
26+
const siWebStats = await si.inetChecksite(getWebUrl());
27+
return {
28+
latency: siWebStats.ms,
29+
responseCode: siWebStats.status,
30+
}
31+
} catch (e) {
32+
console.error("Received unexpected error", e);
33+
return {
34+
latency: -1,
35+
responseCode: 599,
36+
}
2937
}
3038
}
3139

0 commit comments

Comments
 (0)