@opentap/runner-client 2.3.5-alpha.1.1 → 2.3.6-alpha.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/BaseClient.js +9 -6
- package/package.json +1 -1
package/lib/BaseClient.js
CHANGED
|
@@ -145,9 +145,12 @@ var BaseClient = /** @class */ (function () {
|
|
|
145
145
|
responsePromise = new Promise(function (resolve, reject) {
|
|
146
146
|
var messages = [];
|
|
147
147
|
subscription.callback = function (error, message) {
|
|
148
|
-
var _a;
|
|
148
|
+
var _a, _b;
|
|
149
149
|
if (error) {
|
|
150
|
-
reject(error);
|
|
150
|
+
return reject(error);
|
|
151
|
+
}
|
|
152
|
+
if (((_a = message.headers) === null || _a === void 0 ? void 0 : _a.code) === 503) {
|
|
153
|
+
return reject(Error('No responders.'));
|
|
151
154
|
}
|
|
152
155
|
// Put all the response chunks in an array in the order they are received
|
|
153
156
|
messages.push(message);
|
|
@@ -162,13 +165,13 @@ var BaseClient = /** @class */ (function () {
|
|
|
162
165
|
// messages we received. If this is not the case, we dropped a chunk,
|
|
163
166
|
// likely due to a network error. In this case, the entire message is invalid.
|
|
164
167
|
var finalMessage = message;
|
|
165
|
-
var finalMessageNumber = (
|
|
168
|
+
var finalMessageNumber = (_b = finalMessage.headers) === null || _b === void 0 ? void 0 : _b.get('ChunkNumber');
|
|
166
169
|
if (!finalMessageNumber) {
|
|
167
|
-
return reject('Response is not a valid chunk.');
|
|
170
|
+
return reject(Error('Response is not a valid chunk.'));
|
|
168
171
|
}
|
|
169
172
|
if (parseInt(finalMessageNumber) !== messages.length) {
|
|
170
|
-
return reject("Expected {finalMessageNumber} chunks, but received ".concat(messages.length, ". ") +
|
|
171
|
-
"The connection may have been interrupted.");
|
|
173
|
+
return reject(Error("Expected {finalMessageNumber} chunks, but received ".concat(messages.length, ". ") +
|
|
174
|
+
"The connection may have been interrupted."));
|
|
172
175
|
}
|
|
173
176
|
// Concatenate the payloads
|
|
174
177
|
// When there are many chunks, doing a single allocation
|