Handle aborts during json parsing
This commit is contained in:
parent
0bdd4b3d44
commit
2544a5deac
@ -669,7 +669,12 @@ async function fetchJSON(url: string, signal: AbortSignal) {
|
||||
try {
|
||||
json = await response.json();
|
||||
} catch(e) {
|
||||
throw new Error('Request returned invalid json');
|
||||
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