Skip to content

Commit e38d96c

Browse files
committed
Report failed fetches, don't just plough on regardless.
1 parent 4c95be8 commit e38d96c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/modules/pluginBridge/connectionService.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,13 @@ export class WebConnectionService extends EventEmitter {
5353

5454
async fetch(url, { returnHeaders=false, ...options }={}) {
5555
const response = await this.send({ type: 'FETCH', options, url });
56-
return returnHeaders ? [response.data, response.headers] : response.data;
56+
57+
if (response.type === 'FETCH_FAILED') {
58+
throw new ConnectionServiceException(response.error);
59+
}
60+
else {
61+
return returnHeaders ? [response.data, response.headers] : response.data;
62+
}
5763
}
5864

5965
createWebsocket(url, { tag=undefined, autoReconnect=true, protocols=[] }={}) {
@@ -87,3 +93,5 @@ export class WebConnectionService extends EventEmitter {
8793
}
8894

8995
}
96+
97+
class ConnectionServiceException extends Error {}

0 commit comments

Comments
 (0)