From a0baa3e03f4b3f003314ae5e3e94d90a318b39c5 Mon Sep 17 00:00:00 2001 From: Vladimir Skuratovich Date: Thu, 19 Nov 2020 13:35:11 -0800 Subject: [PATCH] Notify RingRTC of Failed HTTP requests --- ts/services/calling.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ts/services/calling.ts b/ts/services/calling.ts index de51a2dd1da..5bb23f6bdb9 100644 --- a/ts/services/calling.ts +++ b/ts/services/calling.ts @@ -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; }