diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/renderer/util.ts | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/renderer/util.ts b/src/renderer/util.ts index 4fedbd5..5ea0c88 100644 --- a/src/renderer/util.ts +++ b/src/renderer/util.ts @@ -48,6 +48,9 @@ export class Listenable<T extends any[]> { export async function getJSON(url: string): Promise<any> { const res = await window.fetch(url); + if (res.status < 200 || res.status >= 300) + throw new Error(res.statusText); + return await res.json(); } |