Notify RingRTC of Failed HTTP requests

This commit is contained in:
Vladimir Skuratovich 2020-11-19 13:35:11 -08:00 committed by Josh Perez
parent b44cabe6f9
commit a0baa3e03f

View file

@ -1219,8 +1219,15 @@ export class CallingClass {
body body
); );
} catch (err) { } catch (err) {
window.log.error('handleSendHttpRequest: fetch failed with error', err); if (err.code !== -1) {
RingRTC.httpRequestFailed(requestId, String(err)); // 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; return;
} }