Handle aborts during json parsing
This commit is contained in:
parent
0bdd4b3d44
commit
2544a5deac
@ -669,8 +669,13 @@ async function fetchJSON(url: string, signal: AbortSignal) {
|
||||
try {
|
||||
json = await response.json();
|
||||
} catch(e) {
|
||||
if(e instanceof DOMException && e.name === 'AbortError') {
|
||||
console.warn(`Request aborted (${url}`);
|
||||
throw e;
|
||||
} else {
|
||||
throw new Error('Request returned invalid json');
|
||||
}
|
||||
}
|
||||
|
||||
return json;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user