Skip to content

Commit

Permalink
Notify RingRTC of Failed HTTP requests
Browse files Browse the repository at this point in the history
  • Loading branch information
vlad-signal authored and josh-signal committed Nov 23, 2020
1 parent b44cabe commit a0baa3e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions ts/services/calling.ts
Expand Up @@ -1219,8 +1219,15 @@ export class CallingClass {
body
);
} catch (err) {
window.log.error('handleSendHttpRequest: fetch failed with error', err);
RingRTC.httpRequestFailed(requestId, String(err));
if (err.code !== -1) {
// WebAPI treats certain response codes as errors, but RingRTC still needs to
// see them. It does not currently look at the response body, so we're giving
// it an empty one.
RingRTC.receivedHttpResponse(requestId, err.code, new ArrayBuffer(0));
} else {
window.log.error('handleSendHttpRequest: fetch failed with error', err);
RingRTC.httpRequestFailed(requestId, String(err));
}
return;
}

Expand Down

0 comments on commit a0baa3e

Please sign in to comment.